summaryrefslogtreecommitdiff
path: root/python/tests/extractor/refmt.py
diff options
context:
space:
mode:
authorAvneesh Saluja <asaluja@gmail.com>2013-03-28 18:28:16 -0700
committerAvneesh Saluja <asaluja@gmail.com>2013-03-28 18:28:16 -0700
commit5b8253e0e1f1393a509fb9975ba8c1347af758ed (patch)
tree1790470b1d07a0b4973ebce19192e896566ea60b /python/tests/extractor/refmt.py
parent2389a5a8a43dda87c355579838559515b0428421 (diff)
parentb203f8c5dc8cff1b9c9c2073832b248fcad0765a (diff)
fixed conflicts
Diffstat (limited to 'python/tests/extractor/refmt.py')
-rwxr-xr-xpython/tests/extractor/refmt.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/python/tests/extractor/refmt.py b/python/tests/extractor/refmt.py
new file mode 100755
index 00000000..437d5b7a
--- /dev/null
+++ b/python/tests/extractor/refmt.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+
+import collections, sys
+
+lines = []
+f = collections.defaultdict(int)
+fe = collections.defaultdict(lambda: collections.defaultdict(int))
+
+for line in sys.stdin:
+ tok = [x.strip() for x in line.split('|||')]
+ count = int(tok[4])
+ f[tok[1]] += count
+ fe[tok[1]][tok[2]] += count
+ lines.append(tok)
+
+for tok in lines:
+ feat = 'IsSingletonF={0}.0 IsSingletonFE={1}.0'.format(
+ 0 if f[tok[1]] > 1 else 1,
+ 0 if fe[tok[1]][tok[2]] > 1 else 1)
+ print ' ||| '.join((tok[0], tok[1], tok[2], feat, tok[3]))