<jupyter_start><jupyter_text>Common words in Accessibility Class<jupyter_code>freq_access = frequency(corpus_accessibility)
freq_access<jupyter_output><empty_output><jupyter_text>Common words in Amenities Class<jupyter_code>freq_amenities = frequency(corpus_amenities)
freq_amenities
from sklearn.feature_extraction.text import CountVectorizer
cv = CountVectorizer()
def taxonomy(corpus):
    X = cv.fit_transform(corpus).toarray()
    features = cv.get_feature_names()
    df_features = pd.DataFrame(X , columns = features)
    return features
features_accessibility = taxonomy(corpus_accessibility)
features_amenities = taxonomy(corpus_amenities)
features_architecture = taxonomy(corpus_architecture)
features_cleanliness = taxonomy(corpus_cleanliness)
features_construction = taxonomy(corpus_construction)
features_cycling = taxonomy(corpus_cycling)
features_parking = taxonomy(corpus_parking)
features_maintenance = taxonomy(corpus_maintenance)
features_green_spaces = taxonomy(corpus_green_spaces)
features_sports_facilities = taxonomy(corpus_sports_facilities)
features_walkability = taxonomy(corpus_walkability)
len(features_walkability)
len(features_walkability)
df_combined = pd.read_excel(r"C:\Users\<NAME>\Desktop\MITACS\combined_reviews.xlsx")
df_combined.head()
def bow_com(df):
    corpus = []
    for i in range(len(df)):
        review = df.loc[i , 'Reviews']
        re.sub('[^a-zA-Z]', ' ', review)
        review = review.lower()
        review = review.split()
        review = [wordnet.lemmatize(word) for word in review if word not in set(stopwords.words('english'))]
        review = ' '.join(review)
        corpus.append(review)
    return corpus
bow_combined = bow_com(df_combined)
type(bow_combined)
taxonomy_overall = taxonomy(bow_combined)
len(taxonomy_overall)
taxonomy_overall
taxonomy_final = []
for i in range(len(taxonomy_overall)):
    wordnet.lemmatize(taxonomy_overall[i])
taxonomy_overall<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09662576687116564, 'fraction_numerical': 0.0, 'mean_word_length': 6.765873015873016, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '285240', 'license': 'MIT', 'n_tokens_mistral': 658, 'n_tokens_neox': 645, 'n_words': 104, 'path': 'Taxonomy_Combined.ipynb', 'repo_name': 'mahajan-abhay/Concordia_University_MITACS', 'size': '1963'}