Exemple #1
0
ckey = 'ZiS77nnXgwbPIVZ5AsvxERCnK'
csecret = 'VKcf7Sfd5mwmpcjSuGOWVCkiLMfpoMOZ5i4LLidCZtwhMUBv8Q'
atoken = '3526839621-Poj6uaa1CNn5WPXK3GFD91NMs0Do1WON3yxkUpE'
asecret = 'Fo0YlmTqMnLbeH3GsgNn1VyEmCIW3IGWuDKDrQ6cWWXD3'

count = 1
interesting_count=0
int_german=0
int_russian=0
init_by = 'user'

_TOTAL_LIMIT = 500
_INTERESTING_LIMIT = 100
_STRICT_INTERESTING_LIMIT_LOWER = 10

tw_writer = fileWriter()

update_url = ['http://localhost:8983/solr/gettingstarted/update/json/docs','http://localhost:7574/solr/gettingstarted/update/json/docs']
update_url_args = ['?split=/'+ \
                  '&f=id:/id' + \
                  '&f=lang:/lang' + \
                  '&f=created_at:/created_at' + \
                  '&f=longitude:/coordinates/longitude' + \
                  '&f=latitude:/coordinates/latitude' + \
                  '&f=text:/text'+ \
                  '&commit=true'+ \
                  '&data=' , \
                  \
                  '?split=/'+ \
                  '&f=id:/id' + \
                  '&f=lang:/lang' + \
import fileWriter as fw
class fileOpcodes():
    instantiate = 1
    move = 2
    fire = 3
    kill = 4
    endgame = 5
    eliminated = 6

writer = fw.fileWriter()
writer.writeLog(1,fileOpcodes.instantiate,(2,3))
writer.writeLog(2,fileOpcodes.move,(2,3),newLoc = (4,3))
writer.writeLog(1,fileOpcodes.fire,(2,3),newLoc = (4,3))
writer.writeLog(2,fileOpcodes.kill,(2,5))
writer.deconstruct()
Exemple #3
0
from fileWriter import fileWriter
from customTweet import customTweet
from urllib import parse
import sys

_static_path = "/home/anudeep3998/cse535/code/"
from_file_path = [_static_path+'tweetDump/eng3.txt', _static_path+'tweetDump/ger3.txt', _static_path+'tweetDump/rus3.txt']
to_file_path = [_static_path+'tweetDump/cus_eng_encoded3.json', _static_path+'tweetDump/cus_ger_encoded3.json', _static_path+'tweetDump/cus_rus_encoded3.json']
custom_header = '['
custom_tail = ']'

count = [0,0,0]
illegal = 0

json_writer = fileWriter(to_file_path,custom_header,custom_tail)
t=0
for fr in from_file_path:
    print("Dumping data from : "+fr)
    with open (fr,"r",encoding='utf-8') as f:
        for line in  f:
            if len(line) > 10 :
                try:
                    tweet = customTweet(parse.unquote_plus(str(line)))
                    json_writer.dump_tweet(tweet.encode_to_json2(), tweet.lang)
                    if tweet.is_lang_english():
                        count[0] = count[0]+1
                    elif tweet.is_lang_german():
                        count[1] = count[1]+1
                    elif tweet.is_lang_russian():
                        count[2] = count[2]+1