12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- import sys
- import web
- import re
- sys.path.append(".")
- import idiolectalyzer
- import collections
- def countWordsIn(sample):
- a = len(sample.split() )
- return a
- def checkWordCount (sample):
- goodCount = 0
- sampleWordcount = countWordsIn(sample)
- if sampleWordcount > 1000:
- goodCount = 1
- return goodCount
- def gatherVariables():
- #findRepeatWords_minFreq,
- #findRepeatWords_context (all,non-function),
- #findRepeatWords_maxWords
- #howCommonIs_context(all_google,google_1965)
- return
- def getTextSampleCommandLine():
- done = 0
- while done == 0:
- sample = raw_input("Enter first text sample, minimum 1000 words:")
- sampleWordCount = countWordsIn( sample ),'\n'
- print sampleWordCount
- counted = checkWordCount( sample )
- if counted == 0:
- print "Sample text must be at least 1000 words."
- sample = "blank"
- else:
- done = 1
-
- sample = idiolectalyzer.stripData(sample)
- return sample
- def getTextSampleWeb():
- urls = ( '/' , 'index.html')
- render = web.template.render('web/')
- app = web.application(globals())
- app.run()
-
- done = 0
- while done == 0:
- sample = web.input(sample=None)
- done = 1
- return sample
- if __name__ == '__main__':
- print "Idiolectalyzer 0.1\n\n"
-
- #gatherVariables()
- #textSample = getTextSampleCommandLine()
- getTextSampleWeb()
-
- print "\nSo it was written"
|