# -*- coding: cp936 -*-
import time
start = time.time()
import sys
import codecs
sys.setrecursionlimit(1000000)
f1=codecs.open('dictionary1.txt','r')
list1=[]
for line in f1:
line = line.strip()
if len(line) == 0:
continue
line = line.split()
for each in line:
if each in list1:
continue
else:
list1.append(each)
f=codecs.open('FMM.txt','w')
def getSeg(text,temp):# 获取分词
if not text:
return ''
if len(text) == 1:
return text
if text in list1:
return text
else:
if temp==1:
text=text[:-1]
else:
text = text[1:]
return getSeg(text,temp
import time
start = time.time()
import sys
import codecs
sys.setrecursionlimit(1000000)
f1=codecs.open('dictionary1.txt','r')
list1=[]
for line in f1:
line = line.strip()
if len(line) == 0:
continue
line = line.split()
for each in line:
if each in list1:
continue
else:
list1.append(each)
f=codecs.open('FMM.txt','w')
def getSeg(text,temp):# 获取分词
if not text:
return ''
if len(text) == 1:
return text
if text in list1:
return text
else:
if temp==1:
text=text[:-1]
else:
text = text[1:]
return getSeg(text,temp