Skip to content

Commit

Permalink
fixed bug, should work with small vocabs
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabor Recski committed Sep 20, 2016
1 parent 6f4a15e commit c4c93bb
Show file tree
Hide file tree
Showing 2 changed files with 10,019 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/fourlang/context.py
Expand Up @@ -67,7 +67,7 @@ def build_ndarray(self):
edges, subjs, objs = self.coocc
for i, edge in enumerate(edges):
subj, obj = subjs[i], objs[i]
self.ndarray[i][subj][obj] += 1
self.ndarray[edge][subj][obj] += 1

def get_w_index(self, word):
if word in self.vocabulary:
Expand Down Expand Up @@ -166,10 +166,11 @@ def main():

cfg = get_cfg(cfg_file)
context = Context(cfg)
# context.build_from_stanford_output(filter_fnc=first_only_filter)
# context.build_from_stanford_output(filter_fnc=short_only_filter)
context.build_from_stanford_output()
context.freeze_vocab()
context.build_ndarray()
# context.build_ndarray() # causes MemoryError
context.save()
context.print_to_files()

Expand Down

0 comments on commit c4c93bb

Please sign in to comment.