Skip to content

Commit

Permalink
Change missing from previous comit
Browse files Browse the repository at this point in the history
  • Loading branch information
jsmackie committed Nov 25, 2016
1 parent 6f3130a commit 344d202
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions corpustools/corpus/classes/lexicon.py
Original file line number Diff line number Diff line change
Expand Up @@ -1039,11 +1039,10 @@ def update(self, old_word):

for attribute, default_value in Word.word_attributes.items():
if hasattr(old_word, attribute):
setattr(self, attribute, getattr(old_word, attribute))# old_word.__dict__[attribute])
setattr(self, attribute, getattr(old_word, attribute))
else:
setattr(self, attribute, default_value)


self.descriptors.extend([att for att in Word.word_attributes if not att.startswith('_')])
self.descriptors = list(set(self.descriptors))

Expand Down Expand Up @@ -1073,6 +1072,18 @@ def update(self, old_word):
self._spelling_name = 'Spelling'
self.descriptors.append('Spelling')

self.Frequency = old_word.__dict__['frequency']
try:
self.descriptors.remove('_frequency')
except ValueError:
pass
try:
self.descriptors.remove('frequency')
except ValueError:
pass
self.descriptors.append('Frequency')


def get_len(self, tier_name):
return len(getattr(self, tier_name))

Expand Down Expand Up @@ -1998,7 +2009,6 @@ def __init__(self, name, update=False):
self.initDefaults()
self.name = name


def initDefaults(self):
for attribute, default_value in Corpus.corpus_attributes.items():
if attribute == 'inventory':
Expand All @@ -2023,7 +2033,6 @@ def update(self, old_corpus):
setattr(self, attribute, default_value)
self._version = currentPCTversion


def update_wordlist(self, new_wordlist):
self.wordlist = dict()
for word in new_wordlist:
Expand Down Expand Up @@ -2577,8 +2586,8 @@ def add_word(self, word, allow_duplicates=False):
if not hasattr(word, 'Frequency'):
word.Frequency = 1
if not word.frequency:
word._frequency = 1
self.wordlist[word.spelling] = copy.copy(word)
word.frequency = 1
self.wordlist[word.spelling] = word#copy.copy(word)
if word.spelling is not None:
if not self.has_spelling:
self.has_spelling = True
Expand Down

0 comments on commit 344d202

Please sign in to comment.