sergegoussev / nlpru Goto Github PK
View Code? Open in Web Editor NEWLibrary to support natural language processing of Russian text
Home Page: https://sergegoussev.github.io/nlpru-docs/
License: MIT License
Library to support natural language processing of Russian text
Home Page: https://sergegoussev.github.io/nlpru-docs/
License: MIT License
In the Semantics
object, the Get_similarity()
method has a parameter similarity_to
that is meant to represent how the output will be formatted. It is however never used in the method.
def Get_similarity(self,
docs_list,
use_normal_form=False,
clean_documents=True,
stop_words=None,
similarity_to='first',
use_ngrams=True):
"""
Get cosine similarity of documents. Uses sklearn's library and the
tf-idf approach (TfidfVectorizer()) to calculate result
(unique) params:
- stop_words: list (or set) of stop words to use
- similarity_to: 'first' or 'all' expected
returns:
depending on 'similarity_to' param, either similarity row
vector of the first document to all others docs is returned, or
(if 'All' is specified) matrix of of all docs against all others
"""
if clean_documents == True:
docs_list = self.__clean_docs__(docs_list)
if use_normal_form == True:
docs_list = self.__normalize_docs__(docs_list)
if use_ngrams == True:
tfidf_vectorizer = TfidfVectorizer(
stop_words=stop_words, ngram_range=(2, 3))
else:
tfidf_vectorizer = TfidfVectorizer(stop_words=stop_words)
tfidf_matrix = tfidf_vectorizer.fit_transform(docs_list)
cosine_similarity_matrix = cosine_similarity(
tfidf_matrix[0:1], tfidf_matrix)
return cosine_similarity_matrix
When FindTopics.Keyword_Match()
is used, it simply matches on the presence of certain words. While it handles the case of keyword overuse (i.e. if a tweet can be categorized to two topics as both topics have the same keyword they are looking for) there is not ability to avoid specific keyword when categorizing tweets.
Say for instance the tweet is "Он бот, но хоть смешной!!"
and we want to categorize tweets that are (a) about just bots, and (b) about funny bots. There is no way to segregate the topic categorization to be so nuanced as look for the same work 'бот'
, but in one topic use the word 'смешной'
but in another topic avoid it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.