-
Notifications
You must be signed in to change notification settings - Fork 1
/
koyo.py
81 lines (70 loc) · 1.51 KB
/
koyo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import sys
import string
import re
import numpy
import nltk.tokenize as ntk
lemma=open('lemma.txt','r')
lines_1 = lemma.readlines()
lemma.close()
kolom=len(lines_1)
#print type(lines_1)
entry=open('entry.txt','r')
lines_2 = entry.readlines()
entry.close()
baris=len(lines_2)
#print type(lines_2)
M=numpy.zeros((baris,kolom),int)
padanan=open('padanan.txt','r')
lines_3 = padanan.readlines()
padanan.close()
#print lines_3
#print type(lines_3)
#print len(lines_3)
panjang=len(lines_3)
rem=[]
rem_2=[]
rem_3=[]
l=[]
h=[]
z=[]
for i in range(panjang):
rem.append(lines_3[i])
token = ntk.word_tokenize(rem[i])
rem_2.append(token[2:])
for j in range(len(lines_2)):
posn=re.match(token[0],lines_2[j])
if posn==None:
pass
else:
pos_n=j
l=rem_2[i]
for k in range(len(l)):
if (k % 2)==0:
h.append(l[k])
z.append(h)
h=[]
token=[]
while (len(z)!=0):
token = ntk.word_tokenize(z[i])
p=string.find(token[0],'-')
if p==-1:
posisi=0
else:
posisi=1
corval=1
if (posisi>0):
token[0] = string.replace(token[0],'-','')
corval=-1
pos_m=re.match(token[0],lines_2[i])
#M=pos_n,corval #change to ndarray matrix?
z.reverse()
z.pop()
z.reverse() #again
#print z
#print len(rem_3)
#print rem_3
#for k in range(len(rem_2[i])):
# l=rem_2[i]
# if (k % 2) == 0:
# rem_3.append(l[k])
#print rem_3