Spaces:
Runtime error
Runtime error
Commit ·
fdfecc8
1
Parent(s): 98239a3
Update topics_extraction.py
Browse files- topics_extraction.py +9 -9
topics_extraction.py
CHANGED
|
@@ -28,8 +28,8 @@ lemmatizer = WordNetLemmatizer()
|
|
| 28 |
evType_stop = set(nltk.corpus.stopwords.words('english'))
|
| 29 |
|
| 30 |
# read configuration file
|
| 31 |
-
config = configparser.ConfigParser()
|
| 32 |
-
config.read('myproject.ini')
|
| 33 |
|
| 34 |
# initialize flask object
|
| 35 |
app = Flask(__name__)
|
|
@@ -37,31 +37,31 @@ app = Flask(__name__)
|
|
| 37 |
|
| 38 |
### files to be load
|
| 39 |
|
| 40 |
-
tag_similarModel_path = config['path']['tag_similar_model'] #word2vec model
|
| 41 |
-
tag_trigram_path = config['path']['tag_trigram'] # trigram phraser
|
| 42 |
-
tag_bigram_path = config['path']['tag_bigram'] # bigram phraser
|
| 43 |
|
| 44 |
tag_similarModel = Word2Vec.load(tag_similarModel_path)
|
| 45 |
tag_trigram_phraser = Phraser.load(tag_trigram_path)
|
| 46 |
tag_bigram_phraser = Phraser.load(tag_bigram_path)
|
| 47 |
|
| 48 |
# load stopword file
|
| 49 |
-
file2 = open(
|
| 50 |
data2 = file2.read()
|
| 51 |
stopword_tag = data2.split(",")
|
| 52 |
|
| 53 |
# load vocabulary of single words
|
| 54 |
-
file3 = open(
|
| 55 |
data3 = file3.read()
|
| 56 |
vocab1 = data3.split(",")
|
| 57 |
|
| 58 |
# load vocabulary of words of length more than 2
|
| 59 |
-
file4 = open(
|
| 60 |
data4 = file4.read()
|
| 61 |
vocab2 = data4.split(",")
|
| 62 |
|
| 63 |
# load vocabulary of words of length 2
|
| 64 |
-
file6 = open(
|
| 65 |
data6 = file6.read()
|
| 66 |
vocab4 = data6.split(",")
|
| 67 |
|
|
|
|
| 28 |
evType_stop = set(nltk.corpus.stopwords.words('english'))
|
| 29 |
|
| 30 |
# read configuration file
|
| 31 |
+
# config = configparser.ConfigParser()
|
| 32 |
+
# config.read('myproject.ini')
|
| 33 |
|
| 34 |
# initialize flask object
|
| 35 |
app = Flask(__name__)
|
|
|
|
| 37 |
|
| 38 |
### files to be load
|
| 39 |
|
| 40 |
+
tag_similarModel_path = "word2vec.model" #config['path']['tag_similar_model'] #word2vec model
|
| 41 |
+
tag_trigram_path = "tri_phrases.txt"#config['path']['tag_trigram'] # trigram phraser
|
| 42 |
+
tag_bigram_path = "bi_phrases.txt"#config['path']['tag_bigram'] # bigram phraser
|
| 43 |
|
| 44 |
tag_similarModel = Word2Vec.load(tag_similarModel_path)
|
| 45 |
tag_trigram_phraser = Phraser.load(tag_trigram_path)
|
| 46 |
tag_bigram_phraser = Phraser.load(tag_bigram_path)
|
| 47 |
|
| 48 |
# load stopword file
|
| 49 |
+
file2 = open("stopwords_tag.txt", "r+")
|
| 50 |
data2 = file2.read()
|
| 51 |
stopword_tag = data2.split(",")
|
| 52 |
|
| 53 |
# load vocabulary of single words
|
| 54 |
+
file3 = open("vocabSingle.txt", "r+")
|
| 55 |
data3 = file3.read()
|
| 56 |
vocab1 = data3.split(",")
|
| 57 |
|
| 58 |
# load vocabulary of words of length more than 2
|
| 59 |
+
file4 = open("vocabMulti.txt", "r+")
|
| 60 |
data4 = file4.read()
|
| 61 |
vocab2 = data4.split(",")
|
| 62 |
|
| 63 |
# load vocabulary of words of length 2
|
| 64 |
+
file6 = open("vocabDouble.txt", "r+")
|
| 65 |
data6 = file6.read()
|
| 66 |
vocab4 = data6.split(",")
|
| 67 |
|