From e27af8a088f3ee2fc2eb2ff9270d7c4a58285bd7 Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Sun, 28 Apr 2024 23:19:07 -0600 Subject: add term paper notebook --- docs/notebooks/phil3030-spring-2024.html | 2015 ++++++++++++++++++++++++++++++ 1 file changed, 2015 insertions(+) create mode 100644 docs/notebooks/phil3030-spring-2024.html (limited to 'docs/notebooks') diff --git a/docs/notebooks/phil3030-spring-2024.html b/docs/notebooks/phil3030-spring-2024.html new file mode 100644 index 0000000..ba44508 --- /dev/null +++ b/docs/notebooks/phil3030-spring-2024.html @@ -0,0 +1,2015 @@ + + + + + + + + + + + + + + + + + + + + PHIL3030 Term Paper + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+
+
+ + + +
+ + + + +
+ + + + + + + + +

Term Paper Code

Subset of code that was used to generate assets and queries for the paper.

+ +

Imports and Configuration

+ + + + + + +
+
import glob
+import os
+import nltk
+import seaborn as sns
+import matplotlib.pyplot as plt
+from wordcloud import WordCloud
+from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
+from nltk.corpus import stopwords
+import re
+from nltk.tokenize import word_tokenize, sent_tokenize
+from sklearn.metrics.pairwise import cosine_similarity
+import pandas as pd
+import numpy as np
+from sentence_transformers import SentenceTransformer, util
+from tqdm import tqdm
+
+ +
+ + + + + + +
+
nltk.download('stopwords')
+nltk.download('punkt')
+
+ +
+ + + + + + +
+
dataset_path = "./dataset"
+assets_path = "./assets"
+image_save_path = "./assets/wordclouds"
+
+ +
+ + + + + + +
+
glob.glob(os.path.join(dataset_path,"*/*"))
+
+ +
+ + + + + + +
+
file_paths = glob.glob(os.path.join(dataset_path,"*/*"))
+
+ +
+

Basic Motif Exploration

+ + + + + + +
+
def create_word_cloud(text, plot=True):
+    text = re.sub(r'[^\x00-\x7F]+', ' ', text)  # Remove non-ASCII chars. Might not be needed after using clean_text
+    text = re.sub(r'\d+', '', text)
+    
+    stop_words_set = set(stopwords.words('english'))
+    stop_words_list = list(stop_words_set.union(set(['.', ',', ';', ':', '!', '?', '(', ')', '[', ']'])))
+    stop_words_list = list(stop_words_set.union(set(["like", "come","index","thou","thee","next","hath","hymn"])))
+
+    token_pattern = r'(?u)\b\w{4,}\b'
+
+    vectorizer = CountVectorizer(stop_words=stop_words_list, token_pattern=token_pattern)
+    word_count = vectorizer.fit_transform([text])
+    
+    words_freq = {word: word_count[0, idx] for word, idx in vectorizer.vocabulary_.items()}
+    
+    wordcloud = WordCloud(width=800, height=400, background_color='white', 
+                          max_words=150, min_font_size=5, random_state=42,
+                          color_func=lambda *args, **kwargs: "black").generate_from_frequencies(words_freq)
+    if plot:
+        plt.figure(figsize=(10, 5))
+        plt.imshow(wordcloud, interpolation='bilinear')
+        plt.axis('off')
+        plt.show()
+    return wordcloud
+
+ +
+ + + + + + +
+
for file in file_paths:
+    with open(file) as f:
+        fname = file.rsplit("/",1)[-1].replace(".txt",".png")
+        print(f"Saving as {fname}")
+        image = create_word_cloud(f.read())
+        image.to_file(os.path.join(image_save_path, fname))
+
+ +
+ +
Saving as Mencius.png
+
+ + + + + + +
Saving as Analects.png
+
+ + + + + + +
Saving as Buddhist Mahâyâna Texts.png
+
+ + + + + + +
Saving as Tao Te Ching.png
+
+ + + + + + +
Saving as The Mahabharata of Krishna-Dwaipayana Vyasa.png
+
+ + + + + + +
Saving as Yajur Veda.png
+
+ + + + + + +
Saving as The Upanishads (Part 1).png
+
+ + + + + + +
Saving as The Upanishads (Part 2).png
+
+ + + + + + +
Saving as The Vishnu Purana.png
+
+ + + + + + +
Saving as Atharva Veda.png
+
+ + + + + + +
Saving as Rig Veda.png
+
+ + + + + + +
Saving as Upanisads (Patrick Olivelle).png
+
+ + + + + + + + + + + + + +
+
for file in file_paths:
+    with open(file) as f:
+        fname = file.rsplit("/",1)[-1].replace(".txt","")
+        print(f"For Text {fname}")
+        words_dict = create_word_cloud(f.read(), False).words_
+        top_20 = [{key: words_dict[key]} for key in list(words_dict.keys())[:20]]
+        print(top_20)
+
+ +
+ +
For Text Mencius
+[{'said': 1.0}, {'mencius': 0.8666666666666667}, {'people': 0.5866666666666667}, {'would': 0.3466666666666667}, {'king': 0.3333333333333333}, {'prince': 0.3295238095238095}, {'kingdom': 0.29904761904761906}, {'shun': 0.21904761904761905}, {'replied': 0.21714285714285714}, {'great': 0.21523809523809523}, {'sovereign': 0.2038095238095238}, {'heaven': 0.18857142857142858}, {'without': 0.18476190476190477}, {'state': 0.18095238095238095}, {'good': 0.17714285714285713}, {'saying': 0.17142857142857143}, {'could': 0.1619047619047619}, {'make': 0.16}, {'confucius': 0.1580952380952381}, {'righteousness': 0.15619047619047619}]
+For Text Analects
+[{'said': 1.0}, {'master': 0.8470209339774557}, {'tsze': 0.2882447665056361}, {'virtue': 0.1723027375201288}, {'asked': 0.16264090177133655}, {'people': 0.15458937198067632}, {'superior': 0.1529790660225443}, {'without': 0.14170692431561996}, {'kung': 0.12238325281803543}, {'confucius': 0.11916264090177134}, {'would': 0.1143317230273752}, {'government': 0.08695652173913043}, {'replied': 0.08695652173913043}, {'good': 0.0853462157809984}, {'things': 0.08373590982286634}, {'propriety': 0.08373590982286634}, {'great': 0.0821256038647343}, {'three': 0.07729468599033816}, {'saying': 0.07729468599033816}, {'cannot': 0.07568438003220612}]
+For Text Buddhist Mahâyâna Texts
+[{'buddha': 1.0}, {'tath': 0.6937984496124031}, {'gata': 0.6337209302325582}, {'world': 0.6085271317829457}, {'thus': 0.5542635658914729}, {'bhagavat': 0.5406976744186046}, {'beings': 0.46705426356589147}, {'knowledge': 0.46511627906976744}, {'subh': 0.4186046511627907}, {'king': 0.4050387596899225}, {'great': 0.39147286821705424}, {'even': 0.38953488372093026}, {'would': 0.3817829457364341}, {'highest': 0.3624031007751938}, {'born': 0.34689922480620156}, {'perfect': 0.3372093023255814}, {'called': 0.32945736434108525}, {'also': 0.3178294573643411}, {'good': 0.3178294573643411}, {'country': 0.313953488372093}]
+For Text Tao Te Ching
+[{'things': 1.0}, {'great': 0.75}, {'therefore': 0.7142857142857143}, {'heaven': 0.6964285714285714}, {'would': 0.6428571428571429}, {'thus': 0.5892857142857143}, {'without': 0.5714285714285714}, {'people': 0.5714285714285714}, {'know': 0.5535714285714286}, {'sage': 0.5535714285714286}, {'state': 0.5}, {'place': 0.375}, {'name': 0.3392857142857143}, {'world': 0.32142857142857145}, {'shall': 0.30357142857142855}, {'life': 0.30357142857142855}, {'knows': 0.30357142857142855}, {'death': 0.30357142857142855}, {'earth': 0.2857142857142857}, {'skilful': 0.2857142857142857}]
+For Text The Mahabharata of Krishna-Dwaipayana Vyasa
+[{'king': 1.0}, {'said': 0.9257425742574258}, {'great': 0.7838283828382838}, {'unto': 0.655940594059406}, {'also': 0.5882838283828383}, {'shall': 0.5173267326732673}, {'continued': 0.4438943894389439}, {'thus': 0.382013201320132}, {'upon': 0.35148514851485146}, {'sons': 0.3457095709570957}, {'became': 0.34075907590759075}, {'brahmana': 0.32425742574257427}, {'monarch': 0.3226072607260726}, {'therefore': 0.3217821782178218}, {'race': 0.30528052805280526}, {'parva': 0.30363036303630364}, {'earth': 0.29455445544554454}, {'arjuna': 0.29372937293729373}, {'even': 0.29125412541254125}, {'pandavas': 0.2887788778877888}]
+For Text Yajur Veda
+[{'verily': 1.0}, {'agni': 0.5768747381650607}, {'sacrifice': 0.576036866359447}, {'gods': 0.5383326351068286}, {'hail': 0.375366568914956}, {'indra': 0.34059488898198576}, {'says': 0.33640552995391704}, {'cattle': 0.26476749057394217}, {'soma': 0.2618349392542941}, {'world': 0.22706325932132385}, {'strength': 0.2220360284876414}, {'earth': 0.2107247591118559}, {'offspring': 0.20276497695852536}, {'food': 0.1977377461248429}, {'fire': 0.19480519480519481}, {'support': 0.19396732299958105}, {'therefore': 0.18852115626309174}, {'sacrificer': 0.16338500209467952}, {'power': 0.16129032258064516}, {'prajapati': 0.15374947633012148}]
+For Text The Upanishads (Part 1)
+[{'self': 1.0}, {'brahman': 0.954233409610984}, {'upanishads': 0.8649885583524027}, {'said': 0.8375286041189931}, {'sacred': 0.8352402745995423}, {'thus': 0.7917620137299771}, {'breath': 0.7116704805491991}, {'therefore': 0.6819221967963387}, {'part': 0.6613272311212814}, {'upanishad': 0.6544622425629291}, {'speech': 0.6384439359267735}, {'food': 0.6155606407322655}, {'first': 0.6064073226544623}, {'world': 0.6041189931350115}, {'texts': 0.5995423340961098}, {'knows': 0.597254004576659}, {'ller': 0.5766590389016019}, {'khanda': 0.5217391304347826}, {'body': 0.5194508009153318}, {'veda': 0.4965675057208238}]
+For Text The Upanishads (Part 2)
+[{'brahman': 1.0}, {'self': 0.9639175257731959}, {'said': 0.9020618556701031}, {'upanishad': 0.4879725085910653}, {'fire': 0.4639175257731959}, {'thus': 0.46048109965635736}, {'world': 0.46048109965635736}, {'avalkya': 0.44329896907216493}, {'food': 0.41408934707903783}, {'body': 0.4020618556701031}, {'knows': 0.37628865979381443}, {'mind': 0.37628865979381443}, {'therefore': 0.3642611683848797}, {'called': 0.3556701030927835}, {'upanishads': 0.3539518900343643}, {'breath': 0.3402061855670103}, {'knowledge': 0.3384879725085911}, {'know': 0.31443298969072164}, {'person': 0.3127147766323024}, {'without': 0.3006872852233677}]
+For Text The Vishnu Purana
+[{'vishn': 1.0}, {'upon': 0.838107098381071}, {'krishn': 0.8306351183063512}, {'also': 0.7870485678704857}, {'sons': 0.709838107098381}, {'gods': 0.7023661270236613}, {'gavata': 0.6911581569115816}, {'brahm': 0.6861768368617683}, {'prince': 0.6189290161892902}, {'earth': 0.6052303860523038}, {'said': 0.6002490660024906}, {'first': 0.5317559153175592}, {'people': 0.5280199252801993}, {'world': 0.5205479452054794}, {'thus': 0.5193026151930261}, {'king': 0.5130759651307597}, {'hari': 0.5080946450809465}, {'called': 0.5056039850560399}, {'text': 0.5006226650062267}, {'three': 0.48194271481942713}]
+For Text Atharva Veda
+[{'indra': 1.0}, {'earth': 0.4840764331210191}, {'gods': 0.47770700636942676}, {'heaven': 0.4681528662420382}, {'agni': 0.39331210191082805}, {'soma': 0.33121019108280253}, {'lord': 0.28821656050955413}, {'mighty': 0.25796178343949044}, {'away': 0.25477707006369427}, {'waters': 0.2531847133757962}, {'sacrifice': 0.2484076433121019}, {'life': 0.2372611464968153}, {'strength': 0.2340764331210191}, {'thine': 0.22452229299363058}, {'wealth': 0.21656050955414013}, {'power': 0.21496815286624205}, {'fathers': 0.20382165605095542}, {'great': 0.1926751592356688}, {'light': 0.18949044585987262}, {'made': 0.18630573248407642}]
+For Text Rig Veda
+[{'indra': 1.0}, {'agni': 0.6608187134502924}, {'soma': 0.520811833505332}, {'gods': 0.5122119023047815}, {'heaven': 0.391812865497076}, {'mighty': 0.31922944616443066}, {'wealth': 0.3126934984520124}, {'earth': 0.27588579291365667}, {'forth': 0.27485380116959063}, {'strength': 0.2741658066735466}, {'strong': 0.2518059855521156}, {'lord': 0.24939800481596147}, {'bring': 0.2301341589267286}, {'great': 0.22256621947024424}, {'sacrifice': 0.21981424148606812}, {'praise': 0.21327829377364982}, {'give': 0.20983832129342966}, {'varu': 0.19951840385276917}, {'holy': 0.19676642586859305}, {'might': 0.19642242862057105}]
+For Text Upanisads (Patrick Olivelle)
+[{'self': 1.0}, {'brahman': 0.92914653784219}, {'world': 0.9210950080515298}, {'breath': 0.7471819645732689}, {'fire': 0.7471819645732689}, {'food': 0.6038647342995169}, {'also': 0.6022544283413849}, {'person': 0.5909822866344605}, {'body': 0.5813204508856683}, {'gods': 0.5314009661835749}, {'within': 0.4895330112721417}, {'knows': 0.48148148148148145}, {'speech': 0.4428341384863124}, {'mind': 0.4428341384863124}, {'term': 0.43156199677938806}, {'three': 0.40418679549114334}, {'said': 0.3993558776167472}, {'death': 0.38164251207729466}, {'becomes': 0.37359098228663445}, {'chant': 0.3687600644122383}]
+
+ + +

Textual Similarity

+ + + + + + +
+
documents = []
+file_names = []
+
+stop_words = set(stopwords.words('english'))
+
+def preprocess(document):
+    tokens = word_tokenize(document.lower())
+    filtered_tokens = [word for word in tokens if word not in stop_words and word.isalpha()]
+    return " ".join(filtered_tokens)
+
+for file_path in file_paths:
+    with open(file_path, 'r', encoding='utf-8') as file:
+        content = file.read()
+        documents.append(preprocess(content))
+        file_names.append(os.path.basename(file_path).replace(".txt",""))
+
+vectorizer = TfidfVectorizer()
+tfidf_matrix = vectorizer.fit_transform(documents)
+cosine_sim_matrix = cosine_similarity(tfidf_matrix)
+similarity_df = pd.DataFrame(cosine_sim_matrix, index=file_names, columns=file_names)
+
+ +
+ + + + + + +
+
plt.figure(figsize=(10, 8)) 
+sns.heatmap(similarity_df, annot=True, fmt=".2f", cmap="coolwarm", cbar=True)
+plt.title('Cosine Similarity Matrix')
+plt.xticks(rotation=45, ha='right') 
+plt.yticks(rotation=0) 
+plt.tight_layout()
+#plt.show()
+plt.savefig(os.path.join(assets_path, "cosine-similarity-matrix.png"))
+
+ +
+ + + + + + + +

Thematic Similarity

+ + + + + + +
+
def clean_text(text):
+    text = re.sub(r'\s+', ' ', text)
+    text = re.sub(r'\[.*?\]', '', text)
+    text = re.sub(r' +', ' ', text)
+    return text.strip()
+
+def load_and_tokenize(path):
+    with open(path, 'r', encoding='utf-8') as file:
+        text = file.read()
+    cleaned_text = clean_text(text)
+    sentences = sent_tokenize(cleaned_text)
+    merged_sentences = []
+    for sentence in sentences:
+        if len(sentence.split()) <= 3:
+            continue
+        merged_sentences.append(sentence)
+    return merged_sentences
+
+ +
+ + + + + + +
+
model = SentenceTransformer('all-MiniLM-L6-v2', device="mps") # Metal!!!!
+
+ +
+ + + + + + +
+
documents = {}
+
+for file_path in file_paths:
+    school = os.path.basename(os.path.dirname(file_path))
+    if school not in documents:
+        documents[school] = {}
+    fname = os.path.basename(file_path).replace(".txt","")
+    documents[school][fname] = {}
+    sentences = load_and_tokenize(file_path)
+    documents[school][fname]["sentences"] =  sentences
+    documents[school][fname]["embeddings"] = model.encode(sentences, batch_size=32, show_progress_bar=True)
+
+ +
+ + + + + + +
+
from sklearn.metrics.pairwise import cosine_similarity
+import numpy as np
+
+def compute_top_pairs_optimized(documents):
+    results = []
+    computed_pairs = set()
+
+    for school1, texts1 in documents.items():
+        # if school1 == "Hinduism":
+        #     continue
+        for doc1, data1 in texts1.items():
+            for school2, texts2 in documents.items():
+                # if school2 == "Hinduism":
+                #     continue
+                if school1 != school2:  # Only compare documents from different schools
+                    for doc2, data2 in texts2.items():
+                        # Ensure each pair is only computed once
+                        if (doc1, doc2) in computed_pairs or (doc2, doc1) in computed_pairs:
+                            continue
+                        computed_pairs.add((doc1, doc2))
+
+                        # Compute cosine similarities
+                        similarities = cosine_similarity(data1["embeddings"], data2["embeddings"])
+                        top_pairs = []  # To keep the top 5 scores for the current document pair
+
+                        # Process similarities to keep only top 5
+                        for i in range(similarities.shape[0]):
+                            for j in range(similarities.shape[1]):
+                                score = similarities[i, j]
+                                # Maintain only top 5 pairs using a sorted insertion strategy
+                                if len(top_pairs) < 5:
+                                    top_pairs.append((score, i, j, doc1, doc2, data1["sentences"][i], data2["sentences"][j]))
+                                    top_pairs.sort(reverse=True, key=lambda x: x[0])
+                                elif score > top_pairs[-1][0]:
+                                    top_pairs[-1] = (score, i, j, doc1, doc2, data1["sentences"][i], data2["sentences"][j])
+                                    top_pairs.sort(reverse=True, key=lambda x: x[0])
+
+                        # Append sorted top pairs to the results
+                        for score, idx1, idx2, doc1, doc2, text1, text2 in top_pairs:
+                            result = {
+                                "score": score,
+                                "text1": text1,
+                                "doc1": doc1,
+                                "text2": text2,
+                                "doc2": doc2
+                            }
+                            results.append(result)
+    return results
+
+ +
+ + + + + + +
+
top_pairs = compute_top_pairs_optimized(documents)
+prev_doc = None
+sub_doc = None
+for pair in top_pairs:
+    if prev_doc != pair["doc1"]:
+        if prev_doc != None: print("--------------------------")
+        print(f"For the text `{pair['doc1']}`:")
+    if sub_doc != pair['doc2']:
+        print(f"Compared with {pair['doc2']}")
+        sub_doc = pair["doc2"]
+        prev_doc = pair['doc1']
+    print(f"Original sentence: {pair['text1']}")
+    print(f"Similar sentence `{pair['text2']}` found in {pair['doc2']}")
+    print(f"Similarity score: {pair['score']:.4f}")
+
+ +
+ +
For the text `Mencius`:
+Compared with Buddhist Mahâyâna Texts
+Original sentence: The king, after all, is one who may be made to do what is good.
+Similar sentence `'Since to be a king involves a wider range of command, therefore the pains of a king are great; for a king is like a peg,--he endures trouble for the sake of the world.` found in Buddhist Mahâyâna Texts
+Similarity score: 0.7040
+Original sentence: The king came to visit him, and said, 'Formerly, I wished to see you, but in vain.
+Similar sentence `The king himself, folding his hands, with a sudden longing come upon him, replied, 'Thou art obtaining thy desire without hindrance; when thou hast at last accomplished all that thou hast to do, thou shalt show hereafter thy favour towards me.'` found in Buddhist Mahâyâna Texts
+Similarity score: 0.6879
+Original sentence: 'If he can give full development to the real feeling of dislike with which he receives the salutation, "Thou," "Thou," he will act righteously in all places and circumstances.
+Similar sentence `'And yet thou, a young man, possessed of strength and beauty, despisest enjoyments which rightly belong to thee, and to which the whole world is devoted.'` found in Buddhist Mahâyâna Texts
+Similarity score: 0.6868
+Original sentence: The king was pleased, and said, 'It is said in the Book of Poetry, "The minds of others, I am able by reflection to measure;" -- this is verified, my Master, in your discovery of my motive.
+Similar sentence `'"Know that all these great kings who were householders were well skilled in attaining the merit which leads to final bliss,--do thou also therefore obtain both simultaneously--royal magnificence and the control over the mind.` found in Buddhist Mahâyâna Texts
+Similarity score: 0.6846
+Original sentence: 'What belongs by his nature to the superior man are benevolence, righteousness, propriety, and knowledge.
+Similar sentence `'Through the merits of good theories virtuous men, who understand noble knowledge, go to heavenly worlds, from their self-restraint as regards body, speech, and thought.` found in Buddhist Mahâyâna Texts
+Similarity score: 0.6844
+Compared with Tao Te Ching
+Original sentence: He who stands in awe of Heaven, will affect with his love and protection his own kingdom.
+Similar sentence `Heaven will save its possessor, by his (very) gentleness protecting him.` found in Tao Te Ching
+Similarity score: 0.7689
+Original sentence: The influence of a mere sage does the same.
+Similar sentence `Therefore the sage, while he never does what is great, is able on that account to accomplish the greatest things.` found in Tao Te Ching
+Similarity score: 0.7660
+Original sentence: He who delights in Heaven, will affect with his love and protection the whole kingdom.
+Similar sentence `Heaven will save its possessor, by his (very) gentleness protecting him.` found in Tao Te Ching
+Similarity score: 0.7489
+Original sentence: The words should all be necessarily sincere, not with any desire to do what is right.
+Similar sentence `81 Sincere words are not fine; fine words are not sincere.` found in Tao Te Ching
+Similarity score: 0.7283
+Original sentence: The influence of a mere sage does the same.
+Similar sentence `Hence the sage puts away excessive effort, extravagance, and easy indulgence.` found in Tao Te Ching
+Similarity score: 0.7244
+Compared with The Mahabharata of Krishna-Dwaipayana Vyasa
+Original sentence: He who respects others is constantly respected by them.
+Similar sentence `He is respected by us all.` found in The Mahabharata of Krishna-Dwaipayana Vyasa
+Similarity score: 0.7956
+Original sentence: 'The king said, "Do not fear.
+Similar sentence `Having said this, he smiled a little and again said, "Fear not for thy life, brave king!` found in The Mahabharata of Krishna-Dwaipayana Vyasa
+Similarity score: 0.7717
+Original sentence: The king replied, 'No.
+Similar sentence `The king answered, "Be it so."` found in The Mahabharata of Krishna-Dwaipayana Vyasa
+Similarity score: 0.7674
+Original sentence: The king replied, 'Oh!
+Similar sentence `The king answered, "Be it so."` found in The Mahabharata of Krishna-Dwaipayana Vyasa
+Similarity score: 0.7644
+Original sentence: I beg your Majesty to greaten it.
+Similar sentence `May it please Your Majesty to enquire who is."` found in The Mahabharata of Krishna-Dwaipayana Vyasa
+Similarity score: 0.7464
+Compared with Yajur Veda
+Original sentence: Respect shown by superiors to inferiors is called giving honour to talents and virtue.
+Similar sentence `He pays reverence; that is as if an inferior brings (something) to a superior and pays him honour.` found in Yajur Veda
+Similarity score: 0.7303
+Original sentence: Respect shown by inferiors to superiors is called giving to the noble the observance due to rank.
+Similar sentence `He pays reverence; that is as if an inferior brings (something) to a superior and pays him honour.` found in Yajur Veda
+Similarity score: 0.7222
+Original sentence: The vessels would not be enough to use.'
+Similar sentence `Some vessels are used (repeatedly), and others not.` found in Yajur Veda
+Similarity score: 0.7127
+Original sentence: The vessels would not be enough to use.'
+Similar sentence `Some vessels are used (repeatedly), others not.` found in Yajur Veda
+Similarity score: 0.7037
+Original sentence: The victims for slaughter, the vessels, and the garments, not being all complete, he does not presume to sacrifice, and then neither may he dare to feel happy."
+Similar sentence `he says, for with purpose does a man employ the sacrifice, planning to sacrifice.` found in Yajur Veda
+Similarity score: 0.7009
+Compared with The Upanishads (Part 1)
+Original sentence: The king replied, 'Oh!
+Similar sentence `Then the king said: 'Alas!` found in The Upanishads (Part 1)
+Similarity score: 0.8258
+Original sentence: The king said,'A great saying!
+Similar sentence `Then the king said: 'Alas!` found in The Upanishads (Part 1)
+Similarity score: 0.7738
+Original sentence: But is this the nature of the mountain?
+Similar sentence `This is the mountain , viz.` found in The Upanishads (Part 1)
+Similarity score: 0.7628
+Original sentence: The king replied, 'No.
+Similar sentence `Then the king said: 'Alas!` found in The Upanishads (Part 1)
+Similarity score: 0.7406
+Original sentence: Knowing his nature, he knows Heaven.
+Similar sentence `He knows what is to happen to-morrow, he knows heaven and hell.` found in The Upanishads (Part 1)
+Similarity score: 0.7383
+Compared with The Upanishads (Part 2)
+Original sentence: and was answered, 'No.'
+Similar sentence `'No,' he replied .` found in The Upanishads (Part 2)
+Similarity score: 0.7484
+Original sentence: What did he find in water to praise?'
+Similar sentence `From him thus worshipping water was produced.` found in The Upanishads (Part 2)
+Similarity score: 0.7435
+Original sentence: These are things which cannot be known.'
+Similar sentence `These are what is known, what is to be known, and what is unknown.` found in The Upanishads (Part 2)
+Similarity score: 0.7355
+Original sentence: 'An ancient sage,' was the reply.
+Similar sentence `The father said: 'What then, you sage?'` found in The Upanishads (Part 2)
+Similarity score: 0.7254
+Original sentence: 'What belongs by his nature to the superior man are benevolence, righteousness, propriety, and knowledge.
+Similar sentence `The wise who perceive him within their Self, to them belongs eternal peace, not to others .'` found in The Upanishads (Part 2)
+Similarity score: 0.7240
+Compared with The Vishnu Purana
+Original sentence: 'From the commencement of the Châu dynasty till now, more than seven hundred years have elapsed.
+Similar sentence `In describing the latter dynasties, some, if not all, of which were no doubt contemporary, they are described as reigning altogether one thousand seven hundred and ninety-six years.` found in The Vishnu Purana
+Similarity score: 0.7224
+Original sentence: A leader of the princes requires a large kingdom.
+Similar sentence `a race of princes, .` found in The Vishnu Purana
+Similarity score: 0.7079
+Original sentence: 'There are those who are great men.
+Similar sentence `All men, illustrious prince, are toiling to be great; but the destinies of men, and not their own exertions, are the cause of greatness.` found in The Vishnu Purana
+Similarity score: 0.7013
+Original sentence: The king, after all, is one who may be made to do what is good.
+Similar sentence `"The king is a speaker of truth, bounteous, an observer of his promises; he is wise, benevolent, patient, valiant, and a terror to the wicked; he knows his duties; he acknowledges services; he is compassionate and kind-spoken; he respects the venerable; he performs sacrifices; he reverences the Brahmans; he cherishes the good; and in administering justice is indifferent to friend or foe."` found in The Vishnu Purana
+Similarity score: 0.6965
+Original sentence: Mencius Chapter 3 1.
+Similar sentence `Part of this passage is in the words of Manu, III.` found in The Vishnu Purana
+Similarity score: 0.6808
+Compared with Atharva Veda
+Original sentence: So a superior man is ashamed of a reputation beyond his merits.'
+Similar sentence `Honour him as superior to himself.` found in Atharva Veda
+Similarity score: 0.6732
+Original sentence: Benevolent and wise:-- Master, you ARE a Sage."
+Similar sentence `Give ear and listen, swiftly-moving Sages, benevolent, invoked in our assembly.` found in Atharva Veda
+Similarity score: 0.6729
+Original sentence: When a Sage shall again arise, he will certainly follow my words.'
+Similar sentence `Let texts recited by the sages bring thee.` found in Atharva Veda
+Similarity score: 0.6604
+Original sentence: When he comes to have a wife and children, his desire is towards them.
+Similar sentence `Unmarried men desire to wed; bountiful givers wish for sons.` found in Atharva Veda
+Similarity score: 0.6565
+Original sentence: Thus, such a ruler will not have an enemy in all the kingdom, and he who has no enemy in the kingdom is the minister of Heaven.
+Similar sentence `For him, strong independent Ruler, Heaven and Earth have fashioned forth for power and might.` found in Atharva Veda
+Similarity score: 0.6534
+Compared with Rig Veda
+Original sentence: He who finds the proper course has many to assist him.
+Similar sentence `He who is passing wise measures his courses out.` found in Rig Veda
+Similarity score: 0.7735
+Original sentence: The sage and we are the same in kind.
+Similar sentence `Sages, I ask you this for information.` found in Rig Veda
+Similarity score: 0.7148
+Original sentence: He approaches the place of mourning, and weeps.
+Similar sentence `Mourner-like, will he weep when first he knows him?` found in Rig Veda
+Similarity score: 0.7112
+Original sentence: 'But now the princes take advantage of the time when throughout their kingdoms there is leisure and rest from external troubles, to abandon themselves to pleasure and indolent indifference;-- they in fact seek for calamities for themselves.
+Similar sentence `So shall the days dawn prosperous for the princes.` found in Rig Veda
+Similarity score: 0.7075
+Original sentence: Of charges, which is the greatest ?
+Similar sentence `What charge hast thou for us?` found in Rig Veda
+Similarity score: 0.6999
+Compared with Upanisads (Patrick Olivelle)
+Original sentence: 'When the sage is beyond our knowledge, he is what is called a spirit-man.
+Similar sentence `It is he, on knowing whom, a man becomes a sage.` found in Upanisads (Patrick Olivelle)
+Similarity score: 0.7543
+Original sentence: But a man must be a sage before he can satisfy the design of his bodily organization.'
+Similar sentence `It is he, on knowing whom, a man becomes a sage.` found in Upanisads (Patrick Olivelle)
+Similarity score: 0.7480
+Original sentence: 'When this great man exercises a transforming influence, he is what is called a sage.
+Similar sentence `It is he, on knowing whom, a man becomes a sage.` found in Upanisads (Patrick Olivelle)
+Similarity score: 0.7370
+Original sentence: He sips the congee.
+Similar sentence `With that he takes a sip.` found in Upanisads (Patrick Olivelle)
+Similarity score: 0.7343
+Original sentence: 'Yes, I do,' was the reply.
+Similar sentence `'Do so,' he replied.` found in Upanisads (Patrick Olivelle)
+Similarity score: 0.7249
+--------------------------
+For the text `Analects`:
+Compared with Buddhist Mahâyâna Texts
+Original sentence: "If I am not to mourn bitterly for this man, for whom should I mourn?"
+Similar sentence `'"Do not think of mourning for me who am gone forth to leave sorrow behind; it is the thralls of passion, who are attached to desires, the causes of sorrow, for whom thou shouldst mourn.` found in Buddhist Mahâyâna Texts
+Similarity score: 0.7461
+Original sentence: After a complete year, the mourning may stop."
+Similar sentence `'"Do not think of mourning for me who am thus gone forth from my home; union, however long it may last, in time will come to an end.` found in Buddhist Mahâyâna Texts
+Similarity score: 0.7086
+Original sentence: When he was passing the vacant place of the prince, his countenance appeared to change, and his legs to bend under him, and his words came as if he hardly had breath to utter them.
+Similar sentence `When he had thus spoken, while the prince was looking on, he suddenly flew up to the sky; it was a heavenly inhabitant who, knowing that the prince's thoughts were other than what his outward form promised, had come to him for the sake of rousing his recollection.` found in Buddhist Mahâyâna Texts
+Similarity score: 0.6882
+Original sentence: When he was passing the vacant place of the prince, his countenance appeared to change, and his legs to bend under him, and his words came as if he hardly had breath to utter them.
+Similar sentence `Then the prince whose form was like the peak of a golden mountain,--whose eye, voice, and arm resembled a bull, a cloud, and an elephant,--whose countenance and prowess were like the moon and a lion,--having a longing aroused for something imperishable,--went into his palace.` found in Buddhist Mahâyâna Texts
+Similarity score: 0.6741
+Original sentence: Having obtained the confidence of his prince, one may then remonstrate with him.
+Similar sentence `The prince having beheld him thus overcome with decrepitude and different in form from other men, with his gaze intently fixed on him, thus addressed his driver with simple confidence: 28.` found in Buddhist Mahâyâna Texts
+Similarity score: 0.6678
+Compared with Tao Te Ching
+Original sentence: Must he not have the qualities of a sage?
+Similar sentence `Therefore the sage, while he never does what is great, is able on that account to accomplish the greatest things.` found in Tao Te Ching
+Similarity score: 0.7522
+Original sentence: He is about a sage.
+Similar sentence `Therefore the sage, while he never does what is great, is able on that account to accomplish the greatest things.` found in Tao Te Ching
+Similarity score: 0.7278
+Original sentence: Must he not have the qualities of a sage?
+Similar sentence `Therefore the (ruling) sage acts without claiming the results as his; he achieves his merit and does not rest (arrogantly) in it:--he does not wish to display his superiority.` found in Tao Te Ching
+Similarity score: 0.7183
+Original sentence: Must he not have the qualities of a sage?
+Similar sentence `The sage does not accumulate (for himself).` found in Tao Te Ching
+Similarity score: 0.7045
+Original sentence: "Were our Master in the position of the ruler of a state or the chief of a family, we should find verified the description which has been given of a sage's rule:-he would plant the people, and forthwith they would be established; he would lead them on, and forthwith they would follow him; he would make them happy, and forthwith multitudes would resort to his dominions; he would stimulate them, and forthwith they would be harmonious.
+Similar sentence `So it is that the sage (ruler), wishing to be above men, puts himself by his words below them, and, wishing to be before them, places his person behind them.` found in Tao Te Ching
+Similarity score: 0.6841
+Compared with The Mahabharata of Krishna-Dwaipayana Vyasa
+Original sentence: On this, he took his departure the next day.
+Similar sentence `At last the time came for his departure.` found in The Mahabharata of Krishna-Dwaipayana Vyasa
+Similarity score: 0.7745
+Original sentence: How is your virtue degenerated!
+Similar sentence `Virtue itself is sustaining a diminution!` found in The Mahabharata of Krishna-Dwaipayana Vyasa
+Similarity score: 0.7371
+Original sentence: "When the love of superiority, boasting, resentments, and covetousness are repressed, this may be deemed perfect virtue."
+Similar sentence `--"This is the foremost of all cherishers of virtue!"` found in The Mahabharata of Krishna-Dwaipayana Vyasa
+Similarity score: 0.7322
+Original sentence: "When the love of superiority, boasting, resentments, and covetousness are repressed, this may be deemed perfect virtue."
+Similar sentence `Let thy heart be more and more firmly set on virtue.'` found in The Mahabharata of Krishna-Dwaipayana Vyasa
+Similarity score: 0.7202
+Original sentence: An esteemer of virtue indeed is this!"
+Similar sentence `--"This is the foremost of all cherishers of virtue!"` found in The Mahabharata of Krishna-Dwaipayana Vyasa
+Similarity score: 0.7186
+Compared with Yajur Veda
+Original sentence: He hates those who proclaim the evil of others.
+Similar sentence `He should think of any one whom he hates; verily does he inflict trouble upon him.` found in Yajur Veda
+Similarity score: 0.7400
+Original sentence: Is it not the sage alone, who can unite in one the beginning and the consummation of learning?"
+Similar sentence `'Rejoiced in by sages', he says , for learned people are sages.` found in Yajur Veda
+Similarity score: 0.7265
+Original sentence: He sacrificed to the dead, as if they were present.
+Similar sentence `He then appropriated the blessing of the sacrifice.` found in Yajur Veda
+Similarity score: 0.7121
+Original sentence: He is about a sage.
+Similar sentence `'Rejoiced in by sages', he says , for learned people are sages.` found in Yajur Veda
+Similarity score: 0.7090
+Original sentence: He hates those who proclaim the evil of others.
+Similar sentence `He should think of whomever he hates; verily he brings affliction upon him.` found in Yajur Veda
+Similarity score: 0.7086
+Compared with The Upanishads (Part 1)
+Original sentence: He sacrificed to the dead, as if they were present.
+Similar sentence `Having eaten them, he went to the sacrifice which was being performed.` found in The Upanishads (Part 1)
+Similarity score: 0.7278
+Original sentence: He sacrificed to the dead, as if they were present.
+Similar sentence `He thus places life and speech in him (the sacrificer.)` found in The Upanishads (Part 1)
+Similarity score: 0.7146
+Original sentence: Food is not his object.
+Similar sentence `To him who knows this there is nothing that is not (proper) food.` found in The Upanishads (Part 1)
+Similarity score: 0.7141
+Original sentence: It is difficult along with him to practice virtue."
+Similar sentence `Here it is clearly said that he has no luck in what he has learnt, and that he does not know the path of virtue.` found in The Upanishads (Part 1)
+Similarity score: 0.7115
+Original sentence: Food is not his object.
+Similar sentence `He to whom this food belongs, to him it has not been given .'` found in The Upanishads (Part 1)
+Similarity score: 0.7077
+Compared with The Upanishads (Part 2)
+Original sentence: Some one asked the meaning of the great sacrifice.
+Similar sentence `He asked: 'And what is the sacrifice?'` found in The Upanishads (Part 2)
+Similarity score: 0.7710
+Original sentence: He answered, "I cannot."
+Similar sentence `'No,' he replied .` found in The Upanishads (Part 2)
+Similarity score: 0.7324
+Original sentence: Some one said to him, "Is it not yet time for you, sir, to leave this?"
+Similar sentence `They said to him: 'Sir, do not depart.` found in The Upanishads (Part 2)
+Similarity score: 0.7151
+Original sentence: He sacrificed to the dead, as if they were present.
+Similar sentence `He desired to sacrifice again with a greater sacrifice.` found in The Upanishads (Part 2)
+Similarity score: 0.7144
+Original sentence: Some one asked the meaning of the great sacrifice.
+Similar sentence `Whatever sacrifices there are, they, taken as one, are the sacrifice.` found in The Upanishads (Part 2)
+Similarity score: 0.7051
+Compared with The Vishnu Purana
+Original sentence: He also introduced to him his two sons.
+Similar sentence `his two sons, .` found in The Vishnu Purana
+Similarity score: 0.7743
+Original sentence: Must he not have the qualities of a sage?
+Similar sentence `He became nevertheless a celebrated sage.` found in The Vishnu Purana
+Similarity score: 0.7223
+Original sentence: He is about a sage.
+Similar sentence `He became nevertheless a celebrated sage.` found in The Vishnu Purana
+Similarity score: 0.7192
+Original sentence: If I do sometimes exceed in praise, there must be ground for it in my examination of the individual.
+Similar sentence `Who is able to declare his praise?` found in The Vishnu Purana
+Similarity score: 0.7178
+Original sentence: When these things proceed from the princes, as a rule, the cases will be few in which they do not lose their power in ten generations.
+Similar sentence `That is, princes and warriors will be so no longer by virtue of their birth and caste.` found in The Vishnu Purana
+Similarity score: 0.7133
+Compared with Atharva Veda
+Original sentence: He sacrificed to the dead, as if they were present.
+Similar sentence `Sacrifice, sacrifice's Lord, he was made head of sacrifice.` found in Atharva Veda
+Similarity score: 0.6976
+Original sentence: He hates those who proclaim the evil of others.
+Similar sentence `Him who hates us may his soul hate, and may he whom we hate hate himself.` found in Atharva Veda
+Similarity score: 0.6892
+Original sentence: He sacrificed to the dead, as if they were present.
+Similar sentence `He is the son of sacrifice: and sacrifice was born from him.` found in Atharva Veda
+Similarity score: 0.6804
+Original sentence: Some one asked the meaning of the great sacrifice.
+Similar sentence `This sacrifice, the first of all, the past, the present, had its birth.` found in Atharva Veda
+Similarity score: 0.6670
+Original sentence: He did not hold it higher than the position of the hands in making a bow, nor lower than their position in giving anything to another.
+Similar sentence `He held a bow, even that Bow of Indra.` found in Atharva Veda
+Similarity score: 0.6654
+Compared with Rig Veda
+Original sentence: He is about a sage.
+Similar sentence `Who knoweth it, ye sages?` found in Rig Veda
+Similarity score: 0.7031
+Original sentence: He sacrificed to the dead, as if they were present.
+Similar sentence `He was their sacrifice that guards our bodies: him the heavens know, the earth, the waters know him.` found in Rig Veda
+Similarity score: 0.6910
+Original sentence: He is about a sage.
+Similar sentence `Sages, I ask you this for information.` found in Rig Veda
+Similarity score: 0.6890
+Original sentence: He is about a sage.
+Similar sentence `6 Sages well-skilled in work, intelligent, drain out the stalk that roars, the Sage, the Everlasting One.` found in Rig Veda
+Similarity score: 0.6738
+Original sentence: "When his knowledge is sufficient to attain, and he has virtue enough to hold fast, if he cannot govern with dignity, the people will not respect him.
+Similar sentence `That which he knows is truth and never idle: he wins and gives the wealth desired of many.` found in Rig Veda
+Similarity score: 0.6705
+Compared with Upanisads (Patrick Olivelle)
+Original sentence: He is about a sage.
+Similar sentence `It is he, on knowing whom, a man becomes a sage.` found in Upanisads (Patrick Olivelle)
+Similarity score: 0.8086
+Original sentence: Some one asked the meaning of the great sacrifice.
+Similar sentence `'What is the sacrifice?'` found in Upanisads (Patrick Olivelle)
+Similarity score: 0.7807
+Original sentence: Must he not have the qualities of a sage?
+Similar sentence `It is he, on knowing whom, a man becomes a sage.` found in Upanisads (Patrick Olivelle)
+Similarity score: 0.7499
+Original sentence: He is about a sage.
+Similar sentence `When he has stopped living like a child or a pundit, he becomes a sage.` found in Upanisads (Patrick Olivelle)
+Similarity score: 0.7428
+Original sentence: If the prince knew propriety, who does not know it?"
+Similar sentence `I told the prince: "I don't know him.` found in Upanisads (Patrick Olivelle)
+Similarity score: 0.7424
+--------------------------
+For the text `Buddhist Mahâyâna Texts`:
+Compared with Tao Te Ching
+Original sentence: '"Either he will quickly come back, having destroyed old age and death; or else he will himself perish, having failed in his purpose and lost hold of every support."'
+Similar sentence `He who does not fail in the requirements of his position, continues long; he who dies and yet does not perish, has longevity.` found in Tao Te Ching
+Similarity score: 0.6750
+Original sentence: 'Some undergo misery for the sake of this world, others meet toil for the sake of heaven; all living beings, wretched through hope and always missing their aim, fall certainly for the sake of happiness into misery.
+Similar sentence `Misery!--happiness is to be found by its side!` found in Tao Te Ching
+Similarity score: 0.6725
+Original sentence: And why is that?
+Similar sentence `And for what reason?` found in Tao Te Ching
+Similarity score: 0.6659
+Original sentence: And why is that?
+Similar sentence `And for what reason?` found in Tao Te Ching
+Similarity score: 0.6659
+Original sentence: But as the king's son was thus going on his way, the very same deities created a dead man, and only the charioteer and the prince, and none else, beheld him as he was carried dead along the road.
+Similar sentence `How should the lord of a myriad chariots carry himself lightly before the kingdom?` found in Tao Te Ching
+Similarity score: 0.6465
+Compared with The Mahabharata of Krishna-Dwaipayana Vyasa
+Original sentence: The king's son asked him a question,--he said to him, 'Tell me, who art thou?'
+Similar sentence `Hearing this, the king asked him, "Whose son art thou?"` found in The Mahabharata of Krishna-Dwaipayana Vyasa
+Similarity score: 0.9100
+Original sentence: There he beheld that lovely forest like Nandana itself.
+Similar sentence `And, as he went, he saw around him a forest like unto Nandana itself (the celestial garden).` found in The Mahabharata of Krishna-Dwaipayana Vyasa
+Similarity score: 0.8490
+Original sentence: Deer and elephants uttering cries of pain ran about or lay down,--in that night as if it were day screaming birds flew around disturbed in all directions.
+Similar sentence `And hosts of creatures roared in pain, and elephants and deer and wolves set up cries of affliction.` found in The Mahabharata of Krishna-Dwaipayana Vyasa
+Similarity score: 0.8033
+Original sentence: The edition of the original text was dedicated to my old friend Professor F. Max Müller, and it is a sincere gratification to me that this translation will appear in the same volume with similar translations from his pen.
+Similar sentence `My friend left with me a specimen of translation which he had received from Professor Max Muller.` found in The Mahabharata of Krishna-Dwaipayana Vyasa
+Similarity score: 0.7721
+Original sentence: And he himself gave to the brahmans for his son's welfare cows full of milk, with no traces of infirmity, golden-horned and with strong healthy calves, to the full number of a hundred thousand.
+Similar sentence `He also gave unto them ten thousand cows belonging to the country of Mathura, and yielding much milk and all of excellent colour.` found in The Mahabharata of Krishna-Dwaipayana Vyasa
+Similarity score: 0.7681
+Compared with Yajur Veda
+Original sentence: 'And as for what thou saidst, "be diligent in sacrifices for religion, such as are worthy of thy race and bring a glorious fruit,"--honour to such sacrifices!
+Similar sentence `Thou art to be invoked at our sacrifices.` found in Yajur Veda
+Similarity score: 0.7682
+Original sentence: 'And as for what thou saidst, "be diligent in sacrifices for religion, such as are worthy of thy race and bring a glorious fruit,"--honour to such sacrifices!
+Similar sentence `'Thou art to be invoked at our sacrifices', he says; for him they invoke at the sacrifices.` found in Yajur Veda
+Similarity score: 0.7469
+Original sentence: 'And as for what thou saidst, "be diligent in sacrifices for religion, such as are worthy of thy race and bring a glorious fruit,"--honour to such sacrifices!
+Similar sentence `'Let us praise the gods worthy of praise; let us honour those worthy of honour; let us sacrifice to those worthy of sacrifice', he says.` found in Yajur Veda
+Similarity score: 0.7469
+Original sentence: 'And as for what thou saidst, "be diligent in sacrifices for religion, such as are worthy of thy race and bring a glorious fruit,"--honour to such sacrifices!
+Similar sentence `n Be thou (good) for every sacrifice, for the gods, for every prayer.` found in Yajur Veda
+Similarity score: 0.7290
+Original sentence: 'And as for what thou saidst, "be diligent in sacrifices for religion, such as are worthy of thy race and bring a glorious fruit,"--honour to such sacrifices!
+Similar sentence `They sacrificed (with the words), 'Thou art a lioness; bring the gods to the pious sacrificer; hail!'` found in Yajur Veda
+Similarity score: 0.7068
+Compared with The Upanishads (Part 1)
+Original sentence: XLIX of The Sacred Books of the East translated by various Oriental scholars and edited by F. Max Müller CONTENTS OF THE TWO PARTS.
+Similar sentence `THE SACRED BOOKS OF THE EAST, TRANSLATED, WITH INTRODUCTIONS AND NOTES, BY VARIOUS ORIENTAL SCHOLARS, AND EDITED BY F. MAX MULLER.` found in The Upanishads (Part 1)
+Similarity score: 0.8626
+Original sentence: No eye, ear, nose, tongue, body, and mind.
+Similar sentence `eye, ear, mind, speech, and breath.` found in The Upanishads (Part 1)
+Similarity score: 0.8312
+Original sentence: No eye, ear, nose, tongue, body, mind.
+Similar sentence `eye, ear, mind, speech, and breath.` found in The Upanishads (Part 1)
+Similarity score: 0.8292
+Original sentence: XLIX of The Sacred Books of the East translated by various Oriental scholars and edited by F. Max Müller CONTENTS OF THE TWO PARTS.
+Similar sentence `The following distinguished scholars, all of them occupying the foremost rank in their own special departments of Oriental literature, are at present engaged in preparing translations of some of the Sacred Books of the East: S. Beal, R. G. Bhandarkar, G. Bühler, A. Burnell, E. B. Cowell, J. Darmesteter, T. W. Rhys Davids, J. Eggeling, V. Fausböll, H. Jacobi, J. Jolly, H. Kern, F. Kielhorn, J. Legge, H. Oldenberg, E. H. Palmer, R. Pischel, K. T. Telang, E. W. West.` found in The Upanishads (Part 1)
+Similarity score: 0.7850
+Original sentence: 'As for the common opinion, "pleasures are enjoyments," none of them when examined are worthy of being enjoyed; fine garments and the rest are only the accessories of things,--they are to be regarded as merely the remedies for pain.
+Similar sentence `'How pleasures and pain?'` found in The Upanishads (Part 1)
+Similarity score: 0.7783
+Compared with The Upanishads (Part 2)
+Original sentence: No eye, ear, nose, tongue, body, mind.
+Similar sentence `Food, breath, the eye, the ear, mind, speech.` found in The Upanishads (Part 2)
+Similarity score: 0.7503
+Original sentence: The king's son asked him a question,--he said to him, 'Tell me, who art thou?'
+Similar sentence `We asked him, 'Who art thou?'` found in The Upanishads (Part 2)
+Similarity score: 0.7497
+Original sentence: ADORATION TO THE OMNISCIENT!
+Similar sentence `Adoration to the Highest Self!` found in The Upanishads (Part 2)
+Similarity score: 0.7465
+Original sentence: ADORATION TO THE OMNISCIENT!
+Similar sentence `Adoration to the Highest Self!` found in The Upanishads (Part 2)
+Similarity score: 0.7465
+Original sentence: ADORATION TO THE OMNISCIENT!
+Similar sentence `Adoration to the Highest Self!` found in The Upanishads (Part 2)
+Similarity score: 0.7465
+Compared with The Vishnu Purana
+Original sentence: OXFORD: Jan. 26, 1894.
+Similar sentence `OXFORD, Feb. 10, 1840.` found in The Vishnu Purana
+Similarity score: 0.8313
+Original sentence: The prince replied, 'Very well,' and having saluted the company of sages he departed; the hermits also having duly performed to him all the rites of courtesy entered again into the ascetic grove.
+Similar sentence `THE prince, having received these instructions, respectfully saluted the sages, and departed from the forest, fully confiding in the accomplishment of his purposes.` found in The Vishnu Purana
+Similarity score: 0.7443
+Original sentence: 'Though he had enjoyed the kingdom of the gods in heaven, when Indra had concealed himself through fear of Vritra, and though in his pride he had made the great Rishis bear his litter'.
+Similar sentence `He had obtained the rank of Indra; but in his pride, or at the suggestion of Śachí, compelling the Rishis to bear his litter, he was cursed by them to fall from his state, and reappear upon earth as a serpent.` found in The Vishnu Purana
+Similarity score: 0.7411
+Original sentence: In course of time to the fair-bosomed Yasodharâ,--who was truly glorious in accordance with her name,--there was born from the son of Suddhodana a son named Râhula, with a face like the enemy of Râhu.
+Similar sentence `There can be no doubt of the individual here intended, although he is out of his place, for he was the son, not the father, of Śuddhodana, and the father of Ráhula; as he is termed in the Amara and Haima Koshas, Śaudhodani or Śuddhodana suta the son of Śuddhodana, and Ráhulasú the parent of Ráhula: so also in the Maháwanśo, Siddhártha or Śákya is the son of Śuddhodano, and father of Ráhulo.` found in The Vishnu Purana
+Similarity score: 0.7344
+Original sentence: 'Thus Ignorance, O ye wise, being fivefold in its character, energises towards torpor, delusion, the great delusion, and the two kinds of darkness.
+Similar sentence `From that great being appeared fivefold Ignorance, consisting of obscurity, illusion, extreme illusion, gloom, utter darkness .` found in The Vishnu Purana
+Similarity score: 0.7242
+Compared with Atharva Veda
+Original sentence: 'Possessed of a thousand sons, and able to deliver the world, be successively the supreme lord of every world from the Yâma heaven onwards.
+Similar sentence `Worship with sacrificial gift King Yama, Vivasvān's son who gathers men together, Yama who was the first to die of mortals, the first who travelled to the world before us.` found in Atharva Veda
+Similarity score: 0.7017
+Original sentence: 'Know me to be the power called Thirst, and worship thirst accordingly; else I will clasp thee with all my might and fling away thy life.'
+Similar sentence `Long be thy grasping-hook wherewith thou givest treasure unto- him Who pours the juice and worships thee.` found in Atharva Veda
+Similarity score: 0.6942
+Original sentence: He then mounted a golden chariot, adorned with reins bright like flashing lightning, and yoked with four gentle horses, all wearing golden trappings.
+Similar sentence `A hundred golden steeds hath he, a hundred chariots wrought of gold.` found in Atharva Veda
+Similarity score: 0.6878
+Original sentence: 'And her, thy second mother, worn with the care of bringing thee up,--thou wilt not surely forget her, as an ingrate a benefit?
+Similar sentence `Thou stablishest the two much-wandering Mothers, and bringest many deeds to their completion.` found in Atharva Veda
+Similarity score: 0.6872
+Original sentence: 'But if from thy pride of race thou dost not now feel confidence in me, then plunge with thy arrows into countless armies, and with me as thy ally seek to conquer thy foes.
+Similar sentence `Thou art victorious in thy might I am endowed with conquering strength: Possessed of overpowering force we two will quell our enemies.` found in Atharva Veda
+Similarity score: 0.6839
+Compared with Rig Veda
+Original sentence: 'And as for what thou saidst, "be diligent in sacrifices for religion, such as are worthy of thy race and bring a glorious fruit,"--honour to such sacrifices!
+Similar sentence `Serving at sacrifices men adore thee as a God, O Sage.` found in Rig Veda
+Similarity score: 0.7456
+Original sentence: 'Now therefore do thou guard (the world) like Indra in heaven; guard it continually like the sun by thy excellencies; guard its best happiness here; guard the earth; guard life by the noble; guard the sons of the good; guard thy royal powers, O king; and guard thine own religion.
+Similar sentence `Be thou the Guard of all, O thou whom many praise.` found in Rig Veda
+Similarity score: 0.7330
+Original sentence: 'And as for what thou saidst, "be diligent in sacrifices for religion, such as are worthy of thy race and bring a glorious fruit,"--honour to such sacrifices!
+Similar sentence `Be thou the sacrificer's strong encourager all these thy deeds are my delight at festivals.` found in Rig Veda
+Similarity score: 0.7269
+Original sentence: 'And as for what thou saidst, "be diligent in sacrifices for religion, such as are worthy of thy race and bring a glorious fruit,"--honour to such sacrifices!
+Similar sentence `Here seat thee like a man: most wise, bring thou the Gods for sacrifice.` found in Rig Veda
+Similarity score: 0.7211
+Original sentence: 'Now therefore do thou guard (the world) like Indra in heaven; guard it continually like the sun by thy excellencies; guard its best happiness here; guard the earth; guard life by the noble; guard the sons of the good; guard thy royal powers, O king; and guard thine own religion.
+Similar sentence `3 O Darter of the Stone, the powers which readily obey thy will,— Divinities, both thou and they, ye rule, to guard them, earth and heaven.` found in Rig Veda
+Similarity score: 0.7204
+Compared with Upanisads (Patrick Olivelle)
+Original sentence: I will explain it now.
+Similar sentence `I will explain it to you.` found in Upanisads (Patrick Olivelle)
+Similarity score: 0.7958
+Original sentence: I have made a few corrections in my translation, and have added some notes and omitted others.
+Similar sentence `For these reasons, I have omitted the phrase from the translation.` found in Upanisads (Patrick Olivelle)
+Similarity score: 0.7399
+Original sentence: Dharma, in the ordinary Buddhist phraseology, may be correctly rendered by law.
+Similar sentence `The term 'law' (dharma) here refers to ritual and moral rules: see KaU 4.14 n. 6.1 visible appearance : see BU 1.4.7 n. Uktha, brahman, Soman: Uktha is the technical term for Rgvedic verses that are recited during a sacrifice (cf.` found in Upanisads (Patrick Olivelle)
+Similarity score: 0.7208
+Original sentence: Form is emptiness, and emptiness indeed is form.
+Similar sentence `And this whole world—both what has form and what is without form—is substance.` found in Upanisads (Patrick Olivelle)
+Similarity score: 0.7166
+Original sentence: But in our treatise dharma is generally used in a different sense.
+Similar sentence `But it cannot be very different from the meaning of the term dharma (also said to be subtle, anu) at KaU 1.21 and from its usage in the next verse, KaU 2.14.` found in Upanisads (Patrick Olivelle)
+Similarity score: 0.7098
+--------------------------
+For the text `Tao Te Ching`:
+Compared with The Mahabharata of Krishna-Dwaipayana Vyasa
+Original sentence: Disgrace is being in a low position (after the enjoyment of favour).
+Similar sentence `There is no disgrace, however, in conciliation."` found in The Mahabharata of Krishna-Dwaipayana Vyasa
+Similarity score: 0.7257
+Original sentence: Misery!--happiness is to be found by its side!
+Similar sentence `Life is sorrow and disease; life is truly a record of misery!` found in The Mahabharata of Krishna-Dwaipayana Vyasa
+Similarity score: 0.7174
+Original sentence: Misery!--happiness is to be found by its side!
+Similar sentence `Happiness and misery are both transient.` found in The Mahabharata of Krishna-Dwaipayana Vyasa
+Similarity score: 0.7010
+Original sentence: Happiness!--misery lurks beneath it!
+Similar sentence `Happiness and misery are both transient.` found in The Mahabharata of Krishna-Dwaipayana Vyasa
+Similarity score: 0.6983
+Original sentence: They shall wear elegant and ornamented robes, carry a sharp sword at their girdle, pamper themselves in eating and drinking, and have a superabundance of property and wealth;--such (princes) may be called robbers and boasters.
+Similar sentence `Adorned with crowns, garlands, bracelets, and other ornaments, endued with mighty arms, possessed of prowess and vigour and bursting with strength and energy, those princes could not, even in imagination, string that bow of extraordinary stiffness.` found in The Mahabharata of Krishna-Dwaipayana Vyasa
+Similarity score: 0.6797
+Compared with Yajur Veda
+Original sentence: He who overcomes others is strong; he who overcomes himself is mighty.
+Similar sentence `He prospers himself , his foe is overcome.` found in Yajur Veda
+Similarity score: 0.7349
+Original sentence: He who overcomes others is strong; he who overcomes himself is mighty.
+Similar sentence `He for whom those are put down becomes greater, conquers these worlds, and prospers himself; his foe is defeated.` found in Yajur Veda
+Similarity score: 0.6848
+Original sentence: Therefore the sage, while he never does what is great, is able on that account to accomplish the greatest things.
+Similar sentence `'Rejoiced in by sages', he says , for learned people are sages.` found in Yajur Veda
+Similarity score: 0.6764
+Original sentence: (But) when there is not faith sufficient (on his part), a want of faith (in him) ensues (on the part of the others).
+Similar sentence `He who offers sacrifice without faith, they place not faith in his sacrifice.` found in Yajur Veda
+Similarity score: 0.6723
+Original sentence: He who gets as his own all under heaven does so by giving himself no trouble (with that end).
+Similar sentence `To him the higher sacrifice condescends, he gains the world of heaven.` found in Yajur Veda
+Similarity score: 0.6695
+Compared with The Upanishads (Part 1)
+Original sentence: To Heaven and Earth.
+Similar sentence `From the sky and from heaven.` found in The Upanishads (Part 1)
+Similarity score: 0.7239
+Original sentence: Having arrived at this point of non-action, there is nothing which he does not do.
+Similar sentence `He does not increase by a good action, nor decrease by a bad action.` found in The Upanishads (Part 1)
+Similarity score: 0.6743
+Original sentence: What other men (thus) teach, I also teach.
+Similar sentence `Who then has taught you ?'` found in The Upanishads (Part 1)
+Similarity score: 0.6726
+Original sentence: He constantly (tries to) keep them without knowledge and without desire, and where there are those who have knowledge, to keep them from presuming to act (on it).
+Similar sentence `He who knows them, obtains whatever he desires.` found in The Upanishads (Part 1)
+Similarity score: 0.6503
+Original sentence: What other men (thus) teach, I also teach.
+Similar sentence `Who has taught you?'` found in The Upanishads (Part 1)
+Similarity score: 0.6493
+Compared with The Upanishads (Part 2)
+Original sentence: Therefore the sage puts his own person last, and yet it is found in the foremost place; he treats his person as if it were foreign to him, and yet that person is preserved.
+Similar sentence `When they have reached him (the Self), the sages become satisfied through knowledge, they are conscious of their Self, their passions have passed away, and they are tranquil.` found in The Upanishads (Part 2)
+Similarity score: 0.7112
+Original sentence: Therefore the sage, in the exercise of his government, empties their minds, fills their bellies, weakens their wills, and strengthens their bones.
+Similar sentence `When they have reached him (the Self), the sages become satisfied through knowledge, they are conscious of their Self, their passions have passed away, and they are tranquil.` found in The Upanishads (Part 2)
+Similarity score: 0.6987
+Original sentence: Therefore the sage desires what (other men) do not desire, and does not prize things difficult to get; he learns what (other men) do not learn, and turns back to what the multitude of men have passed by.
+Similar sentence `When they have reached him (the Self), the sages become satisfied through knowledge, they are conscious of their Self, their passions have passed away, and they are tranquil.` found in The Upanishads (Part 2)
+Similarity score: 0.6925
+Original sentence: Therefore the sage holds in his embrace the one thing (of humility), and manifests it to all the world.
+Similar sentence `When they have reached him (the Self), the sages become satisfied through knowledge, they are conscious of their Self, their passions have passed away, and they are tranquil.` found in The Upanishads (Part 2)
+Similarity score: 0.6854
+Original sentence: I will make this the basis of my teaching.
+Similar sentence `This is the teaching.` found in The Upanishads (Part 2)
+Similarity score: 0.6788
+Compared with The Vishnu Purana
+Original sentence: They shall wear elegant and ornamented robes, carry a sharp sword at their girdle, pamper themselves in eating and drinking, and have a superabundance of property and wealth;--such (princes) may be called robbers and boasters.
+Similar sentence `Princes, instead of protecting, will plunder their subjects; and, under the pretext of levying customs, will rob merchants of their property.` found in The Vishnu Purana
+Similarity score: 0.7230
+Original sentence: It may be regarded as the Mother of all things.
+Similar sentence `It is the mother and nurse of all creatures, the foundation of all worlds, and the chief of the elements.` found in The Vishnu Purana
+Similarity score: 0.7165
+Original sentence: If princes and kings were able to maintain it, all things would of themselves be transformed by them.
+Similar sentence `That is, princes and warriors will be so no longer by virtue of their birth and caste.` found in The Vishnu Purana
+Similarity score: 0.7124
+Original sentence: Therefore the sage, while he never does what is great, is able on that account to accomplish the greatest things.
+Similar sentence `Therefore, most excellent sages, is the Śúdra fortunate.` found in The Vishnu Purana
+Similarity score: 0.7011
+Original sentence: When things (in the vegetable world) have displayed their luxuriant growth, we see each of them return to its root.
+Similar sentence `By this all vegetables grow and are matured, and become the means of maintaining life.` found in The Vishnu Purana
+Similarity score: 0.6867
+Compared with Atharva Veda
+Original sentence: No treasures give good men so rich a grace; Bad men it guards, and doth their ill efface.
+Similar sentence `Discover thou, as Lord, the wealth of men who offer up no gifts: bring thou to us this wealth of theirs.` found in Atharva Veda
+Similarity score: 0.6660
+Original sentence: No treasures give good men so rich a grace; Bad men it guards, and doth their ill efface.
+Similar sentence `For you may he who parts in turn find treasures, but let the Dead among the Fathers.` found in Atharva Veda
+Similarity score: 0.6528
+Original sentence: Heaven and Earth (under its guidance) unite together and send down the sweet dew, which, without the directions of men, reaches equally everywhere as of its own accord.
+Similar sentence `Dear unto all men, facing all directions, with hands and palms on every side extended, He, the sole God, engendering earth and heaven, beareth them with his wings and arms together.` found in Atharva Veda
+Similarity score: 0.6503
+Original sentence: Let him keep his mouth open, and (spend his breath) in the promotion of his affairs, and all his life there will be no safety for him.
+Similar sentence `Let the breath of life forsake him.` found in Atharva Veda
+Similarity score: 0.6463
+Original sentence: Sons shall bring in lengthening line, Sacrifices to his shrine.
+Similar sentence `Serve we with sacrifices, gifts, and homage even thus the Steer of all the Gods, the Father.` found in Atharva Veda
+Similarity score: 0.6455
+Compared with Rig Veda
+Original sentence: To Heaven and Earth.
+Similar sentence `And why to Heaven?` found in Rig Veda
+Similarity score: 0.7093
+Original sentence: 11 The thirty spokes unite in the one nave; but it is on the empty space (for the axle), that the use of the wheel depends.
+Similar sentence `11 Formed with twelve spokes, by length of time, unweakened, rolls round the heaven this wheel of during Order.` found in Rig Veda
+Similarity score: 0.6946
+Original sentence: Therefore the sage, while he never does what is great, is able on that account to accomplish the greatest things.
+Similar sentence `From earth ye brought the sage to life in wondrous mode; be your great deeds done here for him who honours you.` found in Rig Veda
+Similarity score: 0.6934
+Original sentence: Therefore he who would administer the kingdom, honouring it as he honours his own person, may be employed to govern it, and he who would administer it with the love which he bears to his own person may be entrusted with it.
+Similar sentence `Ye Rulers, grant his heart's desire.` found in Rig Veda
+Similarity score: 0.6798
+Original sentence: It might appear to have been before God.
+Similar sentence `Who knows then whence it first came into being?` found in Rig Veda
+Similarity score: 0.6759
+Compared with Upanisads (Patrick Olivelle)
+Original sentence: Therefore the sage, while he never does what is great, is able on that account to accomplish the greatest things.
+Similar sentence `It is he, on knowing whom, a man becomes a sage.` found in Upanisads (Patrick Olivelle)
+Similarity score: 0.7163
+Original sentence: Therefore the sage knows (these things) of himself, but does not parade (his knowledge); loves, but does not (appear to set a) value on, himself.
+Similar sentence `It is he, on knowing whom, a man becomes a sage.` found in Upanisads (Patrick Olivelle)
+Similarity score: 0.7053
+Original sentence: Therefore the sage puts his own person last, and yet it is found in the foremost place; he treats his person as if it were foreign to him, and yet that person is preserved.
+Similar sentence `It is he, on knowing whom, a man becomes a sage.` found in Upanisads (Patrick Olivelle)
+Similarity score: 0.7015
+Original sentence: Therefore the sage desires what (other men) do not desire, and does not prize things difficult to get; he learns what (other men) do not learn, and turns back to what the multitude of men have passed by.
+Similar sentence `It is he, on knowing whom, a man becomes a sage.` found in Upanisads (Patrick Olivelle)
+Similarity score: 0.6903
+Original sentence: The sage does not accumulate (for himself).
+Similar sentence `When he has stopped living like a child or a pundit, he becomes a sage.` found in Upanisads (Patrick Olivelle)
+Similarity score: 0.6870
+
+ + +

Helper Function

This helper function lets someone search for similar themes in other texts

+ + + + + + + +
+
def find_similar_sentences(query, schools, documents, model):
+    query_embedding = model.encode([query])
+    results = []
+
+    for school in schools:
+        if school in documents:
+            for text_name, text_data in documents[school].items():
+                sentence_embeddings = text_data['embeddings']
+                similarities = cosine_similarity(query_embedding, sentence_embeddings)[0]
+                for similarity, sentence in zip(similarities, text_data['sentences']):
+                    results.append((similarity, school, text_name, sentence))
+
+    results.sort(reverse=True, key=lambda x: x[0])
+    
+    return results[:10]
+
+ +
+ + + + + + +
+
schools = ["Hinduism"]
+
+ +
+ + + + + + +
+
similar_sentences = find_similar_sentences("Emphasis on societal roles and personal decorum", schools, documents, model)
+for similarity, school, text_name, sentence in similar_sentences:
+    print(f"School: {school}, Text: {text_name}, Sentence: '{sentence}', Similarity: {similarity:.4f}")
+
+ +
+ +
School: Hinduism, Text: The Vishnu Purana, Sentence: 'Miscellaneous obligations--purificatory, ceremonial, and moral.', Similarity: 0.4666
+School: Hinduism, Text: The Vishnu Purana, Sentence: 'Cleanliness, rules of, .', Similarity: 0.4590
+School: Hinduism, Text: Rig Veda, Sentence: 'Wherefore linger ye with folk who, offering not, are held in high esteem?', Similarity: 0.4429
+School: Hinduism, Text: Rig Veda, Sentence: 'With entertainment we receive thee friendly: effectual be the sacrificer's wishes.', Similarity: 0.4394
+School: Hinduism, Text: The Upanishads (Part 1), Sentence: 'In these days of anthropological research, when no custom is too disgusting to be recorded, no rules of intermarriage too complicated to be disentangled, it may seem strange that the few genuine relics of ancient religion which, as by a miracle, have been preserved to us, should thus have been judged from a purely aesthetic, and not from an historical point of view.', Similarity: 0.4338
+School: Hinduism, Text: The Vishnu Purana, Sentence: 'Aware of this truth, a wise man will never be influenced by the principle of individual appropriation; and regarding them as only transient and temporal possessions, he will not consider children and posterity, lands and property, or whatever else is personal, to be his own.', Similarity: 0.4223
+School: Hinduism, Text: Upanisads (Patrick Olivelle), Sentence: 'So a man should regard only his self as dear to him.', Similarity: 0.4217
+School: Hinduism, Text: The Mahabharata of Krishna-Dwaipayana Vyasa, Sentence: 'It contains an account of various manners and rites.', Similarity: 0.4130
+School: Hinduism, Text: The Vishnu Purana, Sentence: 'Let not a man associate, in residence, sitting, or society, with him whose person or whose house has been blasted by the sighs of the gods, progenitors, and spirits.', Similarity: 0.4122
+School: Hinduism, Text: The Upanishads (Part 1), Sentence: 'Thus while small and vulgar people are always quarrelling, abusive, and slandering, great men seem to have obtained a part of the reward of reflection.', Similarity: 0.4090
+
+ + + + + + + + +
+
schools = ["Confucianism"]
+
+ +
+ + + + + + +
+
similar_sentences = find_similar_sentences("Duty, Dharma, and Ritual Significance", schools, documents, model)
+for similarity, school, text_name, sentence in similar_sentences:
+    print(f"School: {school}, Text: {text_name}, Sentence: '{sentence}', Similarity: {similarity:.4f}")
+
+ +
+ +
School: Confucianism, Text: Analects, Sentence: 'The philosopher Tsang said, "Let there be a careful attention to perform the funeral rites to parents, and let them be followed when long gone with the ceremonies of sacrifice;-then the virtue of the people will resume its proper excellence."', Similarity: 0.4724
+School: Confucianism, Text: Analects, Sentence: 'The Master said, "Abroad, to serve the high ministers and nobles; at home, to serve one's father and elder brothers; in all duties to the dead, not to dare not to exert one's self; and not to be overcome of wine:-which one of these things do I attain to?"', Similarity: 0.4722
+School: Confucianism, Text: Mencius, Sentence: 'Have you not read the Ritual Usages?-- "At the capping of a young man, his father admonishes him.', Similarity: 0.4720
+School: Confucianism, Text: Mencius, Sentence: 'How is it that you give honour to the carpenter and carriage-wright, and slight him who practises benevolence and righteousness?'', Similarity: 0.4673
+School: Confucianism, Text: Mencius, Sentence: ''Let it be seen to that the people use their resources of food seasonably, and expend their wealth only on the prescribed ceremonies:-- so their wealth will be more than can be consumed.', Similarity: 0.4670
+School: Confucianism, Text: Mencius, Sentence: ''The exercise of love between father and son, the observance of righteousness between sovereign and minister, the rules of ceremony between guest and host, the display of knowledge in recognising the talented, and the fulfilling the heavenly course by the sage;-- these are the appointment of Heaven.', Similarity: 0.4668
+School: Confucianism, Text: Mencius, Sentence: 'Moreover, the History says,-- "In the observances of mourning and sacrifice, ancestors are to be followed," meaning that they received those things from a proper source to hand them down.'', Similarity: 0.4637
+School: Confucianism, Text: Analects, Sentence: 'The Master said, "If a man be without the virtues proper to humanity, what has he to do with the rites of propriety?', Similarity: 0.4611
+School: Confucianism, Text: Analects, Sentence: 'What he attached chief importance to were the food of the people, the duties of mourning, and sacrifices.', Similarity: 0.4600
+School: Confucianism, Text: Mencius, Sentence: 'It is said in the Book of Rites, "A prince ploughs himself, and is assisted by the people, to supply the millet for sacrifice.', Similarity: 0.4598
+
+ + + +
+ +
+
+
+ + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3