Created
May 27, 2013 05:19
-
-
Save johnsmith17th/5655294 to your computer and use it in GitHub Desktop.
scws segment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib, urllib2, json | |
def seg(text): | |
data = { 'data': text, 'respond': 'json', 'charset': 'utf-8', 'ignore': 'yes', 'multi': 3 } | |
parm = urllib.urlencode(data) | |
post = urllib2.urlopen(url = 'http://www.ftphp.com/scws/api.php', data = parm, timeout = 10000) | |
response = post.read() | |
data = json.loads(response) | |
return [i['word'] for i in data['words']] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment