Posts

nltk - TypeError - Translate takes one argument.(2 given) Python -

i have following code import nltk, os, json, csv, string, cpickle scipy.stats import scoreatpercentile lmtzr = nltk.stem.wordnet.wordnetlemmatizer() def sanitize(wordlist): answer = [word.translate(none, string.punctuation) word in wordlist] answer = [lmtzr.lemmatize(word.lower()) word in answer] return answer words = [] filename in json_list: words.extend([sanitize(nltk.word_tokenize(' '.join([tweet['text'] tweet in json.load(open(filename,read))])))]) i've tested lines 2-4 in separate testing.py file when wrote import nltk, os, json, csv, string, cpickle scipy.stats import scoreatpercentile wordlist= ['\'the', 'the', '"the'] print wordlist wordlist2 = [word.translate(none, string.punctuation) word in wordlist] print wordlist2 answer = [lmtzr.lemmatize(word.lower()) word in wordlist2] print answer freq = nltk.freqdist(wordlist2) print freq and command prompt returns ['the','the...

git - Heroku does not seem to run most recent version of deployed play application -

yesterday pushed update heroku application online version not seem execute recent code. specifically, new route added results in "action not found" error visible here , akka job schedule in global.onstart not started. not writing log @ least. my conf/routes file contains line get /json/matches controllers.feeddaemon.matches() the corresponding controller exists , implements action def matches = action { implicit request => ok(cache.get(keymatches) match { case some(o) => o.asinstanceof[string] case none => "" }) } needless say, works locally. heroku build did not report errors , went through. i'm using play 2.2.2. application contains git submodule , sbt multi project build. heroku detects git submodule though. if multi project problem, i'd expect build errors or classnotfoundexceptions though. the answer pretty simple. in versions before 2.2, play framework created startup script ...

java - Download list of pages from some domain with URL constraint -

i need download list of pages on domain have specific url endings. for example, have webpage, http://brnensky.denik.cz/ , czech webpage news. every article has url ending post date, http://brnensky.denik.cz/zpravy_region/ruzova-kola-usnadni-presun-po-brne-20140418.html . so find list of urls begin http://brnensky.denik.cz/ , whatever, , example -20140418.html . possible achieve? i'm trying solve in java, other way help. regex be ^http://brnensky\.denik\.cz.*[0-9]{8}\.html logic beginning url , ending date.html , date 8 digit string. you may have escape '/' according tool or lang used implement expression

Lists of term-frequency pairs into a matrix in R -

i have large data set in following format, on each line there document, encoded word:freqency-in-the-document, separated space; lines can of variable length: aword:3 bword:2 cword:15 dword:2 bword:4 cword:20 fword:1 etc... e.g., in first document, "aword" occurs 3 times. want create little search engine, documents (in same format) matching query ranked; though using tfidf , tm package (based on tutorial, requires data in format of termdocumentmatrix: http://anythingbutrbitrary.blogspot.be/2013/03/build-search-engine-in-20-minutes-or.html ). otherwise, use tm's termdocumentmatrix function on corpus of text, catch here have these data indexed in format (and i'd rather use these data, unless format alien , cannot converted). what i've tried far import lines , split them: docs <- scan("data.txt", what="", sep="\n") doclist <- strsplit(docs, "[[:space:]]+") i figured put in loop: doclist2 <- strsplit(docl...

javascript - ArmCharts makechart with click events -

i'm new here bear question i'm going ask. i want create click event armcharts piechart. example, when user click pie chart, open new popup window. my code follow chart = amcharts.makechart("piechart-placeholder2", { "type": "pie", "fontsize": 9.5, "labeltext": "[[percents]]%", "theme": "light", "legend": { "markertype": "circle", "position": "right", "marginright": 80, "automargins": false }, "dataprovider": [{ "perkara": "xxx1", "amaun(rm)": 4444 }, { "perkara": "xxx2", "amaun(rm)": 5555 }, { "perkara": "xxx3", "amaun(rm)": 73344 }, { "perkara": "xxx4", "amaun(rm)": 3322 ...

ios - Why setClipsToBounds:NO disables setCornerRadius: for UItableview? -

Image
i'm creating uiitableview. first cell want have user image button allow him change image. (not complicated). somehow have strange problem: when set setmaskstobounds:no [self.usertable.layer setcornerradius:20.0]; disabled. attaching code output example: //initiate usertable //[self.usertable setclipstobounds:no];//from documentation line set default [self.usertable.layer setcornerradius:20.0]; [self.view addsubview:self.usertable]; later in cellforrowatindexpath: add: [mycellview.contentview addsubview:photo]; //my photo uimageview if uncomment line [self.usertable setclipstobounds:no] get: but corners not rounded more...... read following questions this , this , still cant figure out? did had problem , can provide fix not force me change code? , how 2 options related each other? lot. calling setcornerradius applies mask calayer, used mask bounds , create rounded corner effect. calling setmaskstobounds:no , disabling mechanism used round corners. in...

WSDL/SOAP support on Go? -

i looked around , find support xml. are there packages support soap/wsdl on go? nope. soap sucks, had implement server of already-defined protocol uses soap, listened net/http , decoded/encoded envelopes encoding/xml . in few minutes, served first envelope go.