Skip to content

Commit

Permalink
Adjust the weight of nadya.jp edges
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Speer committed Jan 17, 2018
1 parent 6f74067 commit dfca826
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion conceptnet5/readers/conceptnet4.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,9 @@ def build_sources(parts_dict, preposition_fix=False):

# TODO: this doesn't need to be a class
class CN4Builder(object):
def __init__(self, weight=1.):
self.weight = weight

def handle_assertion(self, parts_dict):
"""
Process one assertion from ConceptNet 4, which appears in the input
Expand Down Expand Up @@ -374,7 +377,7 @@ def handle_assertion(self, parts_dict):
rel=relation, start=start, end=end,
dataset=dataset, license=Licenses.cc_attribution,
sources=[source_dict], surfaceText=frame_text,
weight=weight
weight=weight * self.weight
)

def transform_file(self, input_filename, output_file):
Expand Down
2 changes: 1 addition & 1 deletion conceptnet5/readers/nadya.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def handle_line(line, builder):


def handle_file(input_filename, output_file):
builder = CN4Builder()
builder = CN4Builder(weight=0.1)
out = MsgpackStreamWriter(output_file)
for line in open(input_filename, encoding='utf-8'):
# Get a line from the file
Expand Down

0 comments on commit dfca826

Please sign in to comment.