Code Monkey home page Code Monkey logo

scoper's Introduction

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 -

photoshop on ipad.                   1h 6m 29s
for.                                 54m 16s
ipad.                                50m 37s
photoshop.                           1h 14m 8s
this is a historic center for        3m 48s
would love to play it for you        4m 50s
pro users but designed for all       7m 52s
exactly what you're looking for,     8m 0s
go and use for everything they       8m 52s
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

>>> obj = Scoper()
>>> obj.main('https://www.youtube.com/watch?v=wFTmQ27S7OQ', mode = 'FUZZY', limit = 10)
Enter query string: Apple Watch

[('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

python app.py

CLI usage

> python -W ignore scoper.py --video https://www.youtube.com/watch?v=bfHEnw6Rm-4 --mode FUZZY --limit 10 --language en
Enter query string: prjct airo

air.                                 9m 0s
project aero, our new augmented      1h 6m 7s
well, with project aero, now you     1h 9m 54s
we also showed you project aero,     1h 11m 28s
pro.                                 49m 43s
ipad pro and it protects both        57m 15s
tap.                                 59m 52s
so now with photoshop, project       1h 10m 41s
products, every ipad pro is made     1h 15m 41s
previous air.                        18m 13s


> python -W ignore scoper.py --video https://www.youtube.com/watch?v=bfHEnw6Rm-4 --mode SEMANTIC --limit 10 --language en
Enter query string: i can't wait to introduce you

i am thrilled to be able to tell     46m 43s
you're going to be amazed by         1h 19m 18s
powered by the all-new a12x          51m 26s
but since this is an x chip, it      51m 51s
in fact, this new a12x has more      51m 55s
i can't wait for you to get your     25m 32s
just like in the x-r, we call it     47m 15s
the a12x bionic has an all-new       53m 1s
a few days ago and they're live      40m 31s
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! โญ

If you liked this and also liked my other work, be sure to follow me for more! ๐Ÿ™‚

scoper's People

Contributors

nityanandagohain avatar rameshaditya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scoper's Issues

Suggest to loosen the dependency on fuzzywuzzy

Hi, your project scoper requires "fuzzywuzzy==0.17.0" in its dependency. After analyzing the source code, we found that the following versions of fuzzywuzzy can also be suitable without affecting your project, i.e., fuzzywuzzy 0.16.0. Therefore, we suggest to loosen the dependency on fuzzywuzzy from "fuzzywuzzy==0.17.0" to "fuzzywuzzy>=0.16.0,<=0.17.0" to avoid any possible conflict for importing more packages or for downstream projects that may use scoper.

May I pull a request to further loosen the dependency on fuzzywuzzy?

By the way, could you please tell us whether such dependency analysis may be potentially helpful for maintaining dependencies easier during your development?



We also give our detailed analysis as follows for your reference:

Your project scoper directly uses 1 APIs from package fuzzywuzzy.

fuzzywuzzy.process.extractBests

Beginning from the 1 APIs above, 4 functions are then indirectly called, including 1 fuzzywuzzy's internal APIs and 3 outsider APIs. The specific call graph is listed as follows (neglecting some repeated function occurrences).

[/RameshAditya/scoper]
+--fuzzywuzzy.process.extractBests
|      +--fuzzywuzzy.process.extractWithoutOrder
|      |      +--logging.warning
|      |      +--functools.partial
|      +--heapq.nlargest

We scan fuzzywuzzy's versions and observe that during its evolution between any version from [0.16.0] and 0.17.0, the changing functions (diffs being listed below) have none intersection with any function or API we mentioned above (either directly or indirectly called by this project).

diff: 0.17.0(original) 0.16.0
['fuzzywuzzy.fuzz._token_set', 'fuzzywuzzy.utils.check_for_equivalence', 'fuzzywuzzy.utils.full_process']

As for other packages, the APIs of heapq, logging and functools are called by fuzzywuzzy in the call graph and the dependencies on these packages also stay the same in our suggested versions, thus avoiding any outside conflict.

Therefore, we believe that it is quite safe to loose your dependency on fuzzywuzzy from "fuzzywuzzy==0.17.0" to "fuzzywuzzy>=0.16.0,<=0.17.0". This will improve the applicability of scoper and reduce the possibility of any further dependency conflict with other projects.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.