项目作者: RameshAditya

项目描述 :
Fuzzy and semantic search for captioned YouTube videos.
高级语言: Python
项目地址: git://github.com/RameshAditya/scoper.git
创建时间: 2019-08-29T06:49:10Z
项目社区:https://github.com/RameshAditya/scoper

开源协议:Other

下载


" class="reference-link">https://raw.githubusercontent.com/RameshAditya/scoper/master/github-resources/logo.jpg?token=AECQW6LFNMRDVEGLBMMVKFK5OH7AI

Fuzzy and Semantic Caption-Based Searching for YouTube Videos

https://github.com/RameshAditya/scoper/blob/master/github-resources/demo_fuzzy.gif


Contents


What Scoper is

Scoper is a python script that takes a youtube URL and a user query string as inputs, and returns the timestamps in the video where the content of the caption closely matches the user’s query string.

For example, in the video - https://www.youtube.com/watch?v=bfHEnw6Rm-4 - which is Apple’s October 2018 event, if you were to query Photoshop for ipad, you’d see the following output -

  1. photoshop on ipad. 1h 6m 29s
  2. for. 54m 16s
  3. ipad. 50m 37s
  4. photoshop. 1h 14m 8s
  5. this is a historic center for 3m 48s
  6. would love to play it for you 4m 50s
  7. pro users but designed for all 7m 52s
  8. exactly what you're looking for, 8m 0s
  9. go and use for everything they 8m 52s
  10. product line for years to come, 9m 29s

How Scoper works

Scoper works in two ways.

  • Extract captions and timestamps from the YouTube URL
  • Preprocess the user query and train a Word2Vec model
  • Query over the captions and find the best match. This is done in two ways, as decided by the user -

    • Fuzzy searching

      • Scoper enables you to query over the video’s captions by using fuzzy matching algorithms.
      • This means it searches for the most relevant captions in terms of spelling and finds the nearest match.
      • Done by using variants of Levenshtein’s distance algorithms.
      • Supports multiple languages.
    • Semantic searching

      • Scoper also enables you to query over the video’s captions using semantic sentence similarity algorithms.
      • The performance of semantic searching is highly dependent on the dataset on which the Word2Vec model used is trained on.
      • By default, the Brown’s corpus is used to train the Word2Vec model, and additionally a modified word-mover’s distance algorithm is used to evaluate sentence-sentence similarity.
      • For non-english language querying, the user will have to provide their own dataset.
  • Map back the chosen captions to the original timestamps and return them

How to use Scoper

Shell usage

  1. >>> obj = Scoper()
  2. >>> obj.main('https://www.youtube.com/watch?v=wFTmQ27S7OQ', mode = 'FUZZY', limit = 10)
  3. Enter query string: Apple Watch
  4. [('Apple Watch.', 1796.994), ('the iPad to the Apple watch, and', 318.617), ('Apple Watch has grown in such a', 480.379), ... ]

Web GUI usage

  1. python app.py

CLI usage

  1. > python -W ignore scoper.py --video https://www.youtube.com/watch?v=bfHEnw6Rm-4 --mode FUZZY --limit 10 --language en
  2. Enter query string: prjct airo
  3. air. 9m 0s
  4. project aero, our new augmented 1h 6m 7s
  5. well, with project aero, now you 1h 9m 54s
  6. we also showed you project aero, 1h 11m 28s
  7. pro. 49m 43s
  8. ipad pro and it protects both 57m 15s
  9. tap. 59m 52s
  10. so now with photoshop, project 1h 10m 41s
  11. products, every ipad pro is made 1h 15m 41s
  12. previous air. 18m 13s
  13. > python -W ignore scoper.py --video https://www.youtube.com/watch?v=bfHEnw6Rm-4 --mode SEMANTIC --limit 10 --language en
  14. Enter query string: i can't wait to introduce you
  15. i am thrilled to be able to tell 46m 43s
  16. you're going to be amazed by 1h 19m 18s
  17. powered by the all-new a12x 51m 26s
  18. but since this is an x chip, it 51m 51s
  19. in fact, this new a12x has more 51m 55s
  20. i can't wait for you to get your 25m 32s
  21. just like in the x-r, we call it 47m 15s
  22. the a12x bionic has an all-new 53m 1s
  23. a few days ago and they're live 40m 31s
  24. and all of the new features of 21m 47s

Future Plans

  • Improve the sentence similarity algorithm
  • Include out-of-the-box support for use of pretrained word embeddings
  • Include support for general audio searching using SpeechRecognition APIs to generate a corpus from non-captioned audios

Support Me

If you liked this, leave a star! :star:

If you liked this and also liked my other work, be sure to follow me for more! :slightly_smiling_face: