Commit c3e2e2718fa565986ee47019cd422566c171d96b

Authored by Cristina Muntean
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,14 +94,15 @@ def mergeBlackList(city, cityFile):
94 for line in inputFile: 94 for line in inputFile:
95 lines += 1 95 lines += 1
96 node = Node.parseString(line) 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 print "Dict size: ", len(tokenDict) 106 print "Dict size: ", len(tokenDict)
106 print "Lines: ", lines 107 print "Lines: ", lines
107 print "Updates: ", updates 108 print "Updates: ", updates