How to use the yake.KeywordExtractor function in yake

To help you get started, we’ve selected a few yake examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github LIAAD / yake / tests / test_yake.py View on Github external
mindshare in this community, too    (though it already has plenty of that thanks to Tensorflow
    and other projects).    Kaggle has a bit of a history with Google, too, but that's pretty recent.
    Earlier this month,    Google and Kaggle teamed up to host a $100,000 machine learning competition
    around classifying    YouTube videos. That competition had some deep integrations with the
    Google Cloud Platform, too.    Our understanding is that Google will keep the service running -
    likely under its current name.    While the acquisition is probably more about Kaggle's community
    than technology, Kaggle did build    some interesting tools for hosting its competition and 'kernels',
    too. On Kaggle, kernels are    basically the source code for analyzing data sets and developers can
    share this code on the    platform (the company previously called them 'scripts').  Like similar
    competition-centric sites,    Kaggle also runs a job board, too. It's unclear what Google will do
    with that part of the service.    According to Crunchbase, Kaggle raised $12.5 million (though PitchBook
    says it's $12.75) since its    launch in 2010. Investors in Kaggle include Index Ventures, SV Angel,
    Max Levchin, Naval Ravikant,    Google chief economist Hal Varian, Khosla Ventures and Yuri Milner
    """

    pyake = yake.KeywordExtractor(lan="en",n=3)

    result = pyake.extract_keywords(text_content)

    print(result)

    keywords = [kw[0] for kw in result]

    print(keywords)
    assert "google" in keywords
    assert "kaggle" in keywords
    assert "san francisco" in keywords
    assert "machine learning" in keywords
github LIAAD / yake / yake / cli.py View on Github external
def run_yake(text_content):
		myake = yake.KeywordExtractor(lan=language, n=ngram_size, dedupLim=dedup_lim, dedupFunc=dedup_func,
									  windowsSize=window_size, top=top)
		results = myake.extract_keywords(text_content)

		table = []
		for kw in results:
			if (verbose):
				table.append({"keyword":kw[0], "score":kw[1]})
			else:
				table.append({"keyword":kw[0]})

		print(tabulate(table, headers="keys"))
github LIAAD / yake / docker / Dockerfiles / yake-server / yake-rest-api.py View on Github external
score:
              type: number
    """

    try:
        assert request.json["text"] , "Invalid text"
        assert len(request.json["language"]) == 2, "Invalid language code"
        assert int(request.json["max_ngram_size"]) , "Invalid max_ngram_size"
        assert int(request.json["number_of_keywords"]) , "Invalid number_of_keywords"

        text = request.json["text"]
        language = request.json["language"]
        max_ngram_size = int(request.json["max_ngram_size"])
        number_of_keywords = int(request.json["number_of_keywords"])

        my_yake = yake.KeywordExtractor(lan=language,
                                        n=max_ngram_size,
                                        top=number_of_keywords,
                                        dedupLim=0.8,
                                        windowsSize=2
                                        )

        keywords = my_yake.extract_keywords(text)
        result  = [{"ngram":x[1] ,"score":x[0]} for x in keywords]

        return jsonify(result), HTTPStatus.OK
    except IOError as e:
        return jsonify("Language not supported"), HTTPStatus.BAD_REQUEST
    except Exception as e:
        return jsonify(str(e)), HTTPStatus.BAD_REQUEST

yake

Keyword extraction Python package

LGPL-3.0
Latest version published 4 years ago

Package Health Score

58 / 100
Full package analysis