Commit 26410ad9 authored by Administrator's avatar Administrator

Adding words to pythonic charabia ;)

parent 67adabac
...@@ -6,7 +6,7 @@ import collections ...@@ -6,7 +6,7 @@ import collections
class NgramCache: class NgramCache:
def __init__(self, language): def __init__(self, language):
self._cache = {} self._cache = dict()
self._language = language self._language = language
def __getitem__(self, terms): def __getitem__(self, terms):
...@@ -34,7 +34,7 @@ class FileParser: ...@@ -34,7 +34,7 @@ class FileParser:
# cache for ngrams # cache for ngrams
self._ngramcaches = collections.defaultdicts(NgramCache) self._ngramcaches = collections.defaultdicts(NgramCache)
# extractors # extractors
self._extractors = {} self._extractors = dict()
self._document_nodetype = NodeType.get(label='document') self._document_nodetype = NodeType.get(label='document')
with Language.objects.all() as languages: with Language.objects.all() as languages:
self._languages_iso2 = {language.iso2.lower(): language for language in Language} self._languages_iso2 = {language.iso2.lower(): language for language in Language}
...@@ -61,7 +61,7 @@ class FileParser: ...@@ -61,7 +61,7 @@ class FileParser:
[token for token, tag in extractor.extract_ngrams(text)] [token for token, tag in extractor.extract_ngrams(text)]
) )
else: else:
return {} return dict()
"""Add a document to the database. """Add a document to the database.
""" """
...@@ -115,5 +115,5 @@ class FileParser: ...@@ -115,5 +115,5 @@ class FileParser:
This method shall be overriden by inherited classes. This method shall be overriden by inherited classes.
""" """
def parse(self): def parse(self):
return [] return list()
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