Commit c3e2e2718fa565986ee47019cd422566c171d96b
1 parent
6783c8d9
limiting condition
Showing
1 changed file
with
9 additions
and
8 deletions
Show diff stats
merge_wordcount_with_edge_features.py
... | ... | @@ -94,14 +94,15 @@ def mergeBlackList(city, cityFile): |
94 | 94 | for line in inputFile: |
95 | 95 | lines += 1 |
96 | 96 | node = Node.parseString(line) |
97 | - if node.description in tokenDict: | |
98 | - # update node | |
99 | - existing_node = tokenDict[node.description] | |
100 | - updateNode(existing_node, node) | |
101 | - updates += 1 | |
102 | - else: | |
103 | - tokenDict[node.description] = node | |
104 | - new_nodes += 1 | |
97 | + if node.nodeCount > 1: | |
98 | + if node.description in tokenDict: | |
99 | + # update node | |
100 | + existing_node = tokenDict[node.description] | |
101 | + updateNode(existing_node, node) | |
102 | + updates += 1 | |
103 | + else: | |
104 | + tokenDict[node.description] = node | |
105 | + new_nodes += 1 | |
105 | 106 | print "Dict size: ", len(tokenDict) |
106 | 107 | print "Lines: ", lines |
107 | 108 | print "Updates: ", updates | ... | ... |