Fiish implementing this: """ import pandas as pd import matplotlib.pyplot as plt import…
- User
Fiish implementing this:
""" import pandas as pd import matplotlib.pyplot as plt import seaborn as sns
def get_twitter_stopwords(pre_path=""): """ loads and preprocesses the twitter stopwords "data/edited_top_1000_hebrew_words_twitter_2018.txt" :return: """ df = pd.read_csv(f"{pre_path}../data/edited_top_1000_hebrew_words_twitter_2018.txt", sep=r"\s*|\s*", engine="python", names=["word_freq", "num"]) stopword_list = df["word_freq"].str.replace(r"[(\d+)]", "", regex=True).str.strip().tolist() return stopword_list
def get_stop_words(pre_path=""): with open(f'{pre_path}../data/edited_heb_stopwords.txt', 'r') as file: # Read all lines into a list lines = file.readlines() return [line.strip() for line in lines] + get_twitter_stopwords(pre_path=pre_path)
def load_data(fname): return pd.read_csv(fname, index_col='id')[['tid', 'speaker', 'output']]
def basic_stats(df): print(f"Total number of mentions: {len(df)}") diverse_testimonies = df['tid'].nunique() print(f"Number of diverse testimonies: {diverse_testimonies}") # The total dataset of testimonies has 751 tids, therefor we can compute the percentage of testimonies with mentions. print(f"Percentage of testimonies with mentions: {diverse_testimonies / 751 * 100:.2f}%") print(f"\n~~\n") avg_mentions_per_testimony = len(df) / diverse_testimonies print(f"Average number of mentions per testimony: {avg_mentions_per_testimony}") mentions_per_testimony = df['tid'].value_counts() plt.figure(figsize=(10, 6)) sns.histplot(mentions_per_testimony, bins=30, kde=False) plt.xlabel("Number of mentions per testimony") plt.ylabel("Number of testimonies") plt.title("Histogram of mentions per testimony") plt.savefig("minimal_prompt_mentions_per_testimony_histogram.png")
def lemmatizer(data): """ Implement lemmatization using DictaBERT. :param data: :return: """ return None
def remove_stopwords(df): """ remove stopwords using Tapuz and Twitter Hebrew stopword lists :param df: :return: """ return None
if name == 'main': """ - load the minimal prompt data - print basic stats: 1. the number of mentions in total 2. Number of diverse testimonies 3. average number of mentions per testimony 4. histogram of mentions per testimony - create a word cloud of the mentions after removing common stop words and lemmatizing 1. For lemmatization use DictaBERT 2. For stopwords use Tapuz and Twitter Hebrew stopword lists 5. Save the wordcloud as a PNG file 6. Save the stats as a text file 7. Save the lemmatized and stopwords removed data as a CSV file 8. Afterwords, upload the csv to https://voyant-tools.org/ for further analysis
""" data = load_data("/home/esther/PycharmProjects/edut710/holocaust_mentions/minimal_mentions_2025-10-21.csv") basic_stats(data) data = lemmatizer(data) data = remove_stopwords(data)"""
- Assistant
- User
This is the HF model card for DictaBERT:
DictaBERT: A State-of-the-Art BERT Suite for Modern Hebrew State-of-the-art language model for Hebrew, released here.
This is the fine-tuned model for the lemmatization task.
For the bert-base models for other tasks, see here.
General guidelines for how the lemmatizer works: Given an input text in Hebrew, it attempts to match up each word with the correct lexeme from within the BERT vocabulary.
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.