Commit 964f92fb by Long Thanh Duong

Modify to work with python3

parent a65f5d9f
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
# URL: <http://nltk.org/> # URL: <http://nltk.org/>
# For license information, see LICENSE.TXT # For license information, see LICENSE.TXT
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tempfile import tempfile
import pickle import pickle
import os import os
...@@ -16,8 +19,6 @@ import scipy.sparse as sparse ...@@ -16,8 +19,6 @@ import scipy.sparse as sparse
import numpy as np import numpy as np
from sklearn.datasets import load_svmlight_file from sklearn.datasets import load_svmlight_file
from sklearn import svm from sklearn import svm
from nltk.parse import DependencyGraph
from evaluate import DependencyEvaluator
class Configuration(object): class Configuration(object):
...@@ -41,9 +42,7 @@ class Configuration(object): ...@@ -41,9 +42,7 @@ class Configuration(object):
""" """
# dep_graph.nodes contain list of token for a sentence # dep_graph.nodes contain list of token for a sentence
self.stack = [0] # The root element self.stack = [0] # The root element
self.buffer = range( self.buffer = list(range(1, len(dep_graph.nodes))) # The rest is in the buffer
1, len(
dep_graph.nodes)) # The rest is in the buffer
self.arcs = [] # empty set of arc self.arcs = [] # empty set of arc
self._tokens = dep_graph.nodes self._tokens = dep_graph.nodes
self._max_address = len(self.buffer) self._max_address = len(self.buffer)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment