Skip to content

Instantly share code, notes, and snippets.

View touhi99's full-sized avatar
🎧
Focusing

Touhidul Alam touhi99

🎧
Focusing
View GitHub Profile
def feature_template(self, state, sentence):
feature_list = np.empty((0), int)
stack = state.stack
buffer = state.buffer
ld = state.ld
rd = state.rd
form = sentence.form
pos = sentence.pos
lemma = sentence.lemma
morph = sentence.morph
def train(self, train_data):
print("In trainer...")
u= np.zeros(self.weights.shape, dtype=np.int32)
q=0
for epoch in range(0,1):
correct=0
print("epoch: ",epoch+1)
i=0
for data in train_data:
q += 1
def generate_tree(self, node):
#print(node)
if isinstance(self.find(self.copy_table, node)[1], (list,)):
item = self.find(self.copy_table, node)[1]
item_x = self.find(self.copy_table, node)[2]
item_y = self.find(self.copy_table, node)[3]
self.copy_table.remove(node)
if item_x[0]==0:
x=self.copy_table_reversed[item_x[1]]
#prod -> right-hand side one element
nt -> left-hand side non-terminal
count -> true, if prod is in left
def create_prod_combinations(prod, nt, count):
numset = 1 << count
new_prods = []
for i in range(numset):
nth_nt = 0