Skip to content

Commit

Permalink
fix bug on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
luoruixuan committed Jan 12, 2019
1 parent 03d0d66 commit 4f4aa8a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions pkuseg/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ def basicTrain(config, XTest, tb):
config.diffList.append(config.diff)
scoreList = tb.test(XTest, i)
config.scoreListList.append(scoreList)
score = scoreList[0]

logstr = "iter{} diff={} train-time(sec)={} {}={}%".format(
config.glbIter,
Expand Down
7 changes: 4 additions & 3 deletions pkuseg/toolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def multiThreading(self, X, X2, dynamic=False):
start = i * interval
end = min(start + interval, len(X2))
proc = Process(
target=toolbox.taskRunner_test, args=(self, X2, start, end, Q)
target=toolbox.taskRunner_test, args=(self.Inf, self.Model, X2, start, end, Q)
)
proc.start()
procs.append(proc)
Expand All @@ -271,11 +271,12 @@ def multiThreading(self, X, X2, dynamic=False):
for proc in procs:
proc.join()

def taskRunner_test(self, X2, start, end, Q):
@staticmethod
def taskRunner_test(Inf, Model, X2, start, end, Q):
for k in range(start, end):
x = X2[k]
tags = []
prob = self.Inf.decodeViterbi_fast(self.Model, x._x, tags)
prob = Inf.decodeViterbi_fast(Model, x._x, tags)
Q.put((k, tags))


Expand Down

0 comments on commit 4f4aa8a

Please sign in to comment.