0
나는 일종의 'dicts of dicts'를 만들려고합니다. 1 차 사전은 단어 - 빈도 키 - 값 쌍입니다. 아래 for 루프에 의해 생성 된 'cleaned_words_string'은 분석중인 텍스트를 보유하고 각 상점마다 고유 한 문자열입니다.사전에서 사전 만들기
stop_words = set(stopwords.words('english'))
word_tokens = word_tokenize(cleaned_word_string)
filtered_sentence = [w for w in word_tokens if not w in stop_words]
filtered_sentence = []
for w in word_tokens:
if w.lower() not in stop_words:
filtered_sentence.append(w)
fw_freq = nltk.FreqDist(filtered_sentence).most_common()
freq_dict = dict(fw_freq)
'storename'이 각각의 freq_dict에 연결되도록이 코드를 어떻게 수정할 수 있습니까?
뭔가 같은 : 출력이 될 것
Store_dict = {storename: freq_dict}
있도록 :
Store_dict { '대상'freq_dict, '월마트'freq_dct 등}
아무튼 ' t'{ "Target": freq_dict}'작동합니까? –
음 'store1': 'door : 1', '소리 : 2'등 – Tony
어떤 사전이 어떤 상점에 속하는지 확인하는 방법이 필요합니다. – Tony