Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

removed yelp data from repo, modified position tagging script and adj…

…ective filtering script to handle yelp data too
  • Loading branch information...
commit e36917df18e4dbac7c894a584abb80b1e421af74 1 parent bafa83c
@cathywu authored
Showing with 20 additions and 9 deletions.
  1. +10 −2 adjectives_filter.py
  2. +10 −7 position_tagger.py
View
12 adjectives_filter.py
@@ -18,5 +18,13 @@ def filter_adj(olddir, newdir):
w.close()
if __name__ == "__main__":
- filter_adj(POSPOS_DIR,POSADJ_DIR)
- filter_adj(NEGPOS_DIR,NEGADJ_DIR)
+ # usage: python adjectives_filter.py -d neg
+ # usage: python adjectives_filter.py -d yelp/default/1star
+ from optparse import OptionParser
+ parser = OptionParser()
+ parser.add_option("-d", "--dir", dest="directory")
+ (options, args) = parser.parse_args()
+
+ olddir = "%s_tagged" % options.directory
+ newdir = "%s_adj" % options.directory
+ filter_adj(olddir,newdir)
View
17 position_tagger.py 100644 → 100755
@@ -1,11 +1,6 @@
#!/usr/bin/python
import os
-POS_DIR = "pos"
-NEG_DIR = "neg"
-POSTAGGED_DIR = "pos_position"
-NEGTAGGED_DIR = "neg_position"
-
def tagfiles(olddir, newdir):
if not os.path.isdir(newdir):
os.mkdir(newdir)
@@ -23,5 +18,13 @@ def tagfiles(olddir, newdir):
w.close()
if __name__ == "__main__":
- tagfiles(POS_DIR,POSTAGGED_DIR)
- tagfiles(NEG_DIR,NEGTAGGED_DIR)
+ # usage: python position_tagger.py -d neg
+ # usage: python position_tagger.py -d yelp/default/1star
+ from optparse import OptionParser
+ parser = OptionParser()
+ parser.add_option("-d", "--dir", dest="directory")
+ (options, args) = parser.parse_args()
+
+ olddir = options.directory
+ newdir = "%s_position" % olddir
+ tagfiles(olddir, newdir)
Please sign in to comment.
Something went wrong with that request. Please try again.