Commit 7aa8a68e authored by dirk.wintergruen's avatar dirk.wintergruen

use stored threshold cretaing unique_words

parent fb9502a7
......@@ -116,7 +116,8 @@ class Analyser(object):
def __init__(self,corpus,save_intermediate=False,out_folder=None,workers=5,in_folder=None, all_r=None,
start=None,
end=None,
lang = "en"):
lang = "en",
threshold = 50):
"""
:param corpus: spacy corpus
"""
......@@ -125,7 +126,7 @@ class Analyser(object):
self.corpus = corpus
self.wordCounts = None
self._uniqueWords = None
self.threshold = 50
self.threshold = threshold
self.to_frequent_words = ["planet", "star"] # ,"mass","model","use","system"]
self.out_folder = out_folder
self.save_intermediate = save_intermediate
......@@ -226,6 +227,11 @@ class Analyser(object):
return self.all_r
def createListOfUniqueWords(self, threshold = 50):
"""
:param threshold: new parameter for threshold will overwrite self.threshold
:return:
"""
if self._uniqueWords and self.threshold == threshold:
return self._uniqueWords
......@@ -270,7 +276,7 @@ class Analyser(object):
@property
def uniqueWords(self):
if self._uniqueWords is None:
self.createListOfUniqueWords()
self.createListOfUniqueWords(self.threshold)
return self._uniqueWords
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment