Views
No views yet
roberta-base model that has been domain-adapted to understand and generate text in the style of 19th-century formal and literary English. It was trained on a specialized corpus derived from historical dictionaries and augmented with narrative sentences to build a deep contextual understanding of the vocabulary and syntax of the period.open-mistral-nemo via a batch API) was used to rewrite the formulaic dictionary definitions into high-quality, narrative sentences that mimicked a 19th-century authorial voice.roberta-base tokenizer was augmented. New, important 19th-century words that were poorly represented were added to the existing vocabulary. This preserved the robust tokenization of the original while expanding its domain-specific knowledge.roberta-base model was then trained on the new, cleaned, and narrative-rich dataset. This process, also known as domain adaptation, allowed the model to fine-tune its weights and learn the semantic relationships of its new vocabulary.fill-mask pipeline.1# Install the transformers library
2# !pip install transformers
3
4from transformers import pipeline
5
6# Load the model from the Hugging Face Hub
7mask_filler = pipeline("fill-mask", model="your-username/roberta-base-19th-century") #<-- REPLACE WITH YOUR REPO ID
8
9# --- Example 1: Literary Context ---
10text1 = f"Her countenance, once so bright, betrayed a deep {mask_filler.tokenizer.mask_token}."
11predictions1 = mask_filler(text1, top_k=5)
12print(f"Sentence: {text1}")
13for pred in predictions1:
14 print(f"- {pred['token_str'].strip():<15} | Score: {pred['score']:.4f}")
15
16# --- Example 2: Scientific/Technical Context ---
17text2 = f"The apothecary mixed a poultice for his ailing {mask_filler.tokenizer.mask_token}."
18predictions2 = mask_filler(text2, top_k=5)
19print(f"\nSentence: {text2}")
20for pred in predictions2:
21 print(f"- {pred['token_str'].strip():<15} | Score: {pred['score']:.4f}")
22
23# --- Example 3: Common Phrase ---
24text3 = f"He fought with great courage and {mask_filler.tokenizer.mask_token}."
25predictions3 = mask_filler(text3, top_k=5)
26print(f"\nSentence: {text3}")
27for pred in predictions3:
28 print(f"- {pred['token_str'].strip():<15} | Score: {pred['score']:.4f}")