-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathnamed_entity.py
More file actions
18 lines (15 loc) · 856 Bytes
/
named_entity.py
File metadata and controls
18 lines (15 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Nicolas Della Penna me@nikete.com
# 15/8/2010
# Strips the sentences in the textual entries in afg.csv and puts them one per line for SENNA to input
import csv, os
f = csv.reader(open('afg.csv','r'))
#"ReportKey","DateOccurred","Type","Category","TrackingNumber","Title","Summary","Region","AttackOn","ComplexAttack","ReportingUnit","UnitName","TypeOfUnit","FriendlyWIA","FriendlyKIA","HostNationWIA","HostNationKIA","CivilianWIA","CivilianKIA","EnemyWIA","EnemyKIA","EnemyDetained","MGRS","Latitude","Longitude","OriginatorGroup","UpdatedByGroup","CCIR","Sigact","Affiliation","DColor","Classification"
w = open('afg.text','w')
index = open('afg.textReportKey','w')
for l in f:
for s in l[6].strip('\n').strip('\t').split('.'):
w.write(s+'\n')
index.write(l[0])
w.close()
index.close()
os.system("./senna-osx -ner < afg.text > afg.ner")