From cb4be28b07823639a64afaa34bf3919220a81e12 Mon Sep 17 00:00:00 2001 From: jwansek Date: Tue, 23 Nov 2021 13:05:48 +0000 Subject: first commit, create parser and tf-idf table --- search.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 search.py (limited to 'search.py') diff --git a/search.py b/search.py new file mode 100644 index 0000000..d41d0a2 --- /dev/null +++ b/search.py @@ -0,0 +1,18 @@ +import terms +import sys +import re + +def main(search_words): + + txt = [re.sub(r"[^a-zA-Z\s]", "", i).rstrip().lower() for i in search_words] + + search_words = [] + for i in txt: + search_words += re.split(r"\s+|\n", i) + + search_words = [terms.LEM.lemmatize(i) for i in search_words if i != "" and i not in terms.STOPWORDS] + + print(search_words) + +if __name__ == "__main__": + main(sys.argv[1:]) \ No newline at end of file -- cgit v1.2.3