Add -w switch to getmentions allowing to get stats for all words (whitespace-delimited strings) ever tweeted
This commit is contained in:
parent
def6fca403
commit
0cacd2d0c7
|
@ -13,8 +13,11 @@ def getTweets(mode = "@", path = tools.config.dbpath):
|
||||||
|
|
||||||
for tweet in tweets:
|
for tweet in tweets:
|
||||||
for word in tweet[0].split():
|
for word in tweet[0].split():
|
||||||
if word[0] == mode:
|
if word[0] == mode or mode == "":
|
||||||
handle = mode + re.split('[\\W]',word[1:])[0].lower()
|
if mode == "":
|
||||||
|
handle = word
|
||||||
|
else:
|
||||||
|
handle = mode + re.split('[\\W]',word[1:])[0].lower()
|
||||||
if handle != mode:
|
if handle != mode:
|
||||||
try:
|
try:
|
||||||
handles[handle] += 1
|
handles[handle] += 1
|
||||||
|
@ -34,6 +37,8 @@ if __name__ == "__main__":
|
||||||
for arg in sys.argv[1:]:
|
for arg in sys.argv[1:]:
|
||||||
if arg == "-h":
|
if arg == "-h":
|
||||||
mode = "#"
|
mode = "#"
|
||||||
|
if arg == "-w":
|
||||||
|
mode = ""
|
||||||
else:
|
else:
|
||||||
path = arg
|
path = arg
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue