Compare commits

..

34 Commits

Author SHA1 Message Date
8b8e15b082 auto rtl has been added 2023-10-21 15:37:32 +03:00
8352a0a097 summery 2023-08-12 18:19:37 +03:00
0e26118247 remove problems 2023-08-12 18:13:10 +03:00
f8e1c4d062 demostration 2023-08-12 17:46:38 +03:00
46152eadbf update of processing 2023-08-12 15:41:13 +03:00
01525451c7 added processing 2023-08-10 18:09:19 +03:00
be4e16ed35 update the project data collecting and the steps for it 2023-08-09 18:54:42 +03:00
5f91215acd update the project data collecting and the steps for it 2023-08-09 17:20:43 +03:00
server
1e4f87368e update the report progress 2023-08-09 00:37:42 +03:00
server
aad15a2a5a readme 2023-08-08 18:53:05 +03:00
server
ee5983a7c5 updated source data, data grab 2023-08-08 18:36:53 +03:00
server
acc006df1b Merge branch 'master' of https://git.saret.tk/saret/DH 2023-08-08 17:11:29 +03:00
server
31d2007bcb no raw data 2023-08-08 17:06:12 +03:00
server
0b66f6cf1d no raw data 2023-08-08 17:06:12 +03:00
server
e7e18c3300 updated goals 2023-08-08 16:59:57 +03:00
server
cc8dfeea0d updated goals 2023-08-08 16:59:57 +03:00
server
8f0dd858e2 readme update 2023-08-08 16:28:08 +03:00
server
0448b6c447 readme update 2023-08-08 16:28:08 +03:00
server
1b6d0d2129 readme update 2023-08-08 16:27:47 +03:00
server
78e9e7502a readme update 2023-08-08 16:27:47 +03:00
server
afe0eaf41d readme update 2023-08-08 16:26:18 +03:00
server
adad325c44 readme update 2023-08-08 16:26:18 +03:00
server
0118af822c readme update 2023-08-08 16:26:01 +03:00
server
f784ad9999 readme update 2023-08-08 16:26:01 +03:00
server
bab0735bf7 readme up 2023-08-08 16:25:04 +03:00
server
5af637c650 readme up 2023-08-08 16:25:04 +03:00
server
1545cdac8d starting the report 2023-08-08 16:08:55 +03:00
server
fcdbfe86fa starting the report 2023-08-08 16:08:55 +03:00
server
201626c66a update report 2023-08-08 15:57:25 +03:00
server
5233079481 update report 2023-08-08 15:57:25 +03:00
2735fb9ea2 failed scraping 2023-06-27 11:53:56 +03:00
09aa16dcc8 failed scraping 2023-06-27 11:53:56 +03:00
98d3d5994f boolean similarity 2023-06-26 23:21:34 +03:00
826a100f24 update 2023-06-26 23:12:28 +03:00
10 changed files with 118 additions and 82268 deletions

1
.gitignore vendored
View File

@@ -3,3 +3,4 @@ logs/*
.vscode/*
.ipynb_checkpoints/*
__pycache__/*
*.csv

View File

@@ -1,5 +1,48 @@
# DH
This is the project for course {ENTERCOUSENUMBER} of Dr. Renana Keidar
This is the project for course 33503 of Dr. Renana Keidar
Project, By Benny Saret
# דו"ח התקדמות
## מטרות
מטרת הפרוייקט היא לייצר דרך למצוא קרבה או אינטראקסטואליות בין טקסטים שונים באכדית בין תקופות שונות, סוגות שונות ומרחקים גיאוגרפיים. [אינטרטקסטואליות](https://www.merriam-webster.com/dictionary/intertextually) הוא מונח המתאר מערכת קרבה וקשר בין טקסט מסויים לטקסטים אחרים, המשתמשים כחומר מצע, התכתבות, או ויכוח לאותו טקסט. את אותה קרבה ניתן לראות בעזרת מינוחים דומים, דימויים דומים, שיבוצי כתובים ועוד.
## נתוני מקור
נתוני המקור כולם נלקחו מפרוייקט ORACC [The Open Richly Annotated Cuneiform Corpus](http://oracc.museum.upenn.edu/ "ORACC, (לקמן, אוראקק)"). פרוייקט זה, הוא הפרוייקט הגדול והמקיף ביותר של טקסטים בכתב יתדות, פתוחים ונגישים לשימוש לקהל הרחב, ולחוקרים מכול הסוגים. הנתונים מגיעים בפורמטי JSON,TEI,XML ו־HTML, ומתעדכנים בכול עת.
בפרוייקט ישנם לא רק טקסטים באכדית, אלא גם טקסטים באוררטית, שומרית וכן גם טקסטים בשפות משולבות של איזורי סְפָֿר.
## אופן העבודה
### איסוף הנתונים
<style>
ul{
align: right;
direction: rtl;
}
li{
align: right;
direction: rtl;
}
</style>
השלב הראשון בפרוייקט היה איסוף הנתונים מאוראקק. תת השלבים של האיסוף היו:
1. הקמת נתונון לשמירה של המידע הנאסף. הנתונון שנבחר היה postgresql, נתונון יחסי המממש את שפת SQL.
1. יצירת טבלאות להכנסת הנתונים. לשם כך נוצרו הטבלאות הבאות
- סוגה: טבלא בשם סוגה (genre) שמרה בתוכה את הסוגה של כול טקסט, לפי קוד הטקסט. [Genre](https://dh.saret.tk/dh/api/ggenre)
- פרוייקט: טבלא בשם פרוייקט (project) שמרה בתוכה את כלל שמות הפרוייקטים ותתי הפרוייקטים. טבלא זו נדרש בעיקר בשלב גרידת הטקסטים.[Project](https://dh.saret.tk/dh/api/gprojects)
- תעתיק: טבלא בשם new כללה את התעתיק המפוצל לאכדית, יחד עם המזהה של הטקסט, על מנת להצמיד ביניהם בהמשך. [New](https://dh.saret.tk/dh/api/gnew)
- תרגום: טבלא נוספת הייתה טבלא בשם raw_texts שמטרתה הייתה להחזיק את כלל התרגומים של הטקסטים. [Jsons](https://dh.saret.tk/dh/api/gjson)
- ניתן לראות את כלל הקישרוים ב[קישורים](https://dh.saret.tk/dh/api/links)
1. כתיבת קוד פייתון אשר יוריד את כלל המידע, ויכניס אותו לנתונון.
### עיבוד הנתונים
השלב הבא, לאחר איסוף הנתונים, הוא שלב העיבוד. שלב זה היה יחסית מאתגר. לאחר חודשים שבהם ניסיתי להריץ מספר מודלים פשוטים כגון Word2Vec, TF-IDF, Doc2Vec ועוד, התקבלו תוצאות מוזרות, של קשרים שהתאימו רק בין טקסט לבין עצמו, התאמה של 1, והשאר, היו על התאמה של 0.
לאחר מספר חודשים של ניסיונות, ונטישות, פניתי לעזרת פורום פייסבוק בקבוצת MDLI, שם הציעו לי מחדש ללכת על מודלים פשוטים, ואף שלחו לי מספר קישורים מתוך medium ([TF-IDF Vectorizer scikit-learn](https://medium.com/@cmukesh8688/tf-idf-vectorizer-scikit-learn-dbc0244a911a) ו־[Understanding TF-IDF and Cosine Similarity for Recommendation Engine](https://medium.com/geekculture/understanding-tf-idf-and-cosine-similarity-for-recommendation-engine-64d8b51aa9f9) ), והייתה לי התקדמות במודל. ואולם, על אף שהצליחו לצאת לי תוצאות, לא הצלחתי לייצר גרף מהווקטורים הללו.
### הדגמת תוצאות
שני טקסטים שנמצאו בעלי קרבה של כ־87% הם למשל, [P394767](http://oracc.iaas.upenn.edu/btto/P394767/html) ו־[P395011](http://oracc.iaas.upenn.edu/btto/P395011/html). לאחר בדיקה קצרה של הטקסטים הללו, גם לעיניים שלי, הם נראו דומים. ובאמת, שני הטקסטים הללו מגיעים מאותה רשימה קאנונית המכונה "House most high". באוראקק אין כול אזכור ש־P394767 הוא מתוך הרשימה ההיא, אך המודל מצא את הדמיון, והעלה זאת לבדו.
# סיכום
בסופו של דבר, המודל הצליח להציג תוצאות טובות, אך עדיין לא מספקות. על כן, יש צורך בעבודה נוספת על המודל, ובפרט על הנתונים שהוכנסו למודל. כמו כן, יש צורך בעבודה על הגרף עצמו, ובפרט על הצגתו למשתמש באופן נוח וידידותי. המודל, והשיטה יכולים להוות התקדמות למחקר עתידי, לפיתוחו ולשימוש להבנת האכדית בצורה טובה יותר.

View File

@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
@@ -12,6 +12,7 @@
"from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer\n",
"import pandas as pd\n",
"import scipy\n",
"import numpy as np\n",
"\n",
"df_eng = pd.read_csv('raw_texts.csv')\n",
"df_akk = pd.read_csv('new.csv')\n",
@@ -23,7 +24,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
@@ -34,7 +35,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
@@ -44,7 +45,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
@@ -55,26 +56,63 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"abcd = np.where((cc > 0.5)&( cc< 1))\n",
"abcd[0].tofile(\"data.csv\", sep = \",\", format = \"%d\")"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"ename": "ValueError",
"evalue": "Cannot set a DataFrame with multiple columns to the single column Genre",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[1;32mIn[22], line 2\u001b[0m\n\u001b[0;32m 1\u001b[0m df_genre \u001b[39m=\u001b[39m pd\u001b[39m.\u001b[39mread_csv(\u001b[39m'\u001b[39m\u001b[39mgenre.csv\u001b[39m\u001b[39m'\u001b[39m)\n\u001b[1;32m----> 2\u001b[0m df_akk[\u001b[39m\"\u001b[39;49m\u001b[39mGenre\u001b[39;49m\u001b[39m\"\u001b[39;49m] \u001b[39m=\u001b[39m pd\u001b[39m.\u001b[39mconcat([df_genre, df_akk], axis\u001b[39m=\u001b[39m\u001b[39m1\u001b[39m, join\u001b[39m=\u001b[39m\u001b[39m'\u001b[39m\u001b[39minner\u001b[39m\u001b[39m'\u001b[39m, keys\u001b[39m=\u001b[39m\u001b[39m'\u001b[39m\u001b[39mProject\u001b[39m\u001b[39m'\u001b[39m)\n",
"File \u001b[1;32mc:\\Users\\Saret\\Programming\\C#\\DH\\venv\\lib\\site-packages\\pandas\\core\\frame.py:3949\u001b[0m, in \u001b[0;36mDataFrame.__setitem__\u001b[1;34m(self, key, value)\u001b[0m\n\u001b[0;32m 3947\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_setitem_array(key, value)\n\u001b[0;32m 3948\u001b[0m \u001b[39melif\u001b[39;00m \u001b[39misinstance\u001b[39m(value, DataFrame):\n\u001b[1;32m-> 3949\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_set_item_frame_value(key, value)\n\u001b[0;32m 3950\u001b[0m \u001b[39melif\u001b[39;00m (\n\u001b[0;32m 3951\u001b[0m is_list_like(value)\n\u001b[0;32m 3952\u001b[0m \u001b[39mand\u001b[39;00m \u001b[39mnot\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mcolumns\u001b[39m.\u001b[39mis_unique\n\u001b[0;32m 3953\u001b[0m \u001b[39mand\u001b[39;00m \u001b[39m1\u001b[39m \u001b[39m<\u001b[39m \u001b[39mlen\u001b[39m(\u001b[39mself\u001b[39m\u001b[39m.\u001b[39mcolumns\u001b[39m.\u001b[39mget_indexer_for([key])) \u001b[39m==\u001b[39m \u001b[39mlen\u001b[39m(value)\n\u001b[0;32m 3954\u001b[0m ):\n\u001b[0;32m 3955\u001b[0m \u001b[39m# Column to set is duplicated\u001b[39;00m\n\u001b[0;32m 3956\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_setitem_array([key], value)\n",
"File \u001b[1;32mc:\\Users\\Saret\\Programming\\C#\\DH\\venv\\lib\\site-packages\\pandas\\core\\frame.py:4103\u001b[0m, in \u001b[0;36mDataFrame._set_item_frame_value\u001b[1;34m(self, key, value)\u001b[0m\n\u001b[0;32m 4100\u001b[0m \u001b[39mreturn\u001b[39;00m\n\u001b[0;32m 4102\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mlen\u001b[39m(value\u001b[39m.\u001b[39mcolumns) \u001b[39m!=\u001b[39m \u001b[39m1\u001b[39m:\n\u001b[1;32m-> 4103\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mValueError\u001b[39;00m(\n\u001b[0;32m 4104\u001b[0m \u001b[39m\"\u001b[39m\u001b[39mCannot set a DataFrame with multiple columns to the single \u001b[39m\u001b[39m\"\u001b[39m\n\u001b[0;32m 4105\u001b[0m \u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mcolumn \u001b[39m\u001b[39m{\u001b[39;00mkey\u001b[39m}\u001b[39;00m\u001b[39m\"\u001b[39m\n\u001b[0;32m 4106\u001b[0m )\n\u001b[0;32m 4108\u001b[0m \u001b[39mself\u001b[39m[key] \u001b[39m=\u001b[39m value[value\u001b[39m.\u001b[39mcolumns[\u001b[39m0\u001b[39m]]\n",
"\u001b[1;31mValueError\u001b[0m: Cannot set a DataFrame with multiple columns to the single column Genre"
"name": "stdout",
"output_type": "stream",
"text": [
"Using matplotlib backend: <object object at 0x00000212CB626CA0>\n"
]
}
],
"source": [
"df_genre = pd.read_csv('genre.csv')\n",
"df_akk[\"Genre\"] = pd.concat([df_genre, df_akk], axis=1, join='inner', keys='Project')"
"%matplotlib\n",
"import matplotlib.pyplot as plt\n",
"import seaborn as sns"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"f = sns.scatterplot(bool_similarity)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Project P394767\n",
"Text x x x BAD₃-ku-ri-gal-zi x E₂ 44 ša₂ BAD₃-{d}su...\n",
"Genre lexical\n",
"Name: 4, dtype: object"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df_akk.iloc[4,:]"
]
},
{
@@ -87,7 +125,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "venv",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
@@ -102,8 +140,7 @@
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
},
"orig_nbformat": 4
}
},
"nbformat": 4,
"nbformat_minor": 2

25491
genre.csv

File diff suppressed because it is too large Load Diff

12998
new.csv

File diff suppressed because one or more lines are too long

View File

@@ -1,52 +0,0 @@
1,adsd
2,aemw
3,akklove
4,amgg
5,ario
6,armep
7,arrim
8,asbp
9,atae
10,babcity
11,blms
12,btmao
13,btto
14,cams
15,caspo
16,ccpo
17,cdli
18,ckst
19,cmawro
20,contrib
23,ctij
24,dcclt
25,dccmt
26,doc
27,dsst
28,ecut
29,eisl
30,epsd2
31,etcsri
32,glass
33,hbtin
34,lacost
35,lovelyrics
36,neo
37,nere
38,nimrud
39,obel
40,obmc
41,obta
42,ogsl
43,oimea
44,pnao
45,qcat
46,riao
47,ribo
48,rimanum
49,rinap
50,saao
51,suhu
52,tcma
53,tsae
54,xcat
1 1 adsd
2 2 aemw
3 3 akklove
4 4 amgg
5 5 ario
6 6 armep
7 7 arrim
8 8 asbp
9 9 atae
10 10 babcity
11 11 blms
12 12 btmao
13 13 btto
14 14 cams
15 15 caspo
16 16 ccpo
17 17 cdli
18 18 ckst
19 19 cmawro
20 20 contrib
21 23 ctij
22 24 dcclt
23 25 dccmt
24 26 doc
25 27 dsst
26 28 ecut
27 29 eisl
28 30 epsd2
29 31 etcsri
30 32 glass
31 33 hbtin
32 34 lacost
33 35 lovelyrics
34 36 neo
35 37 nere
36 38 nimrud
37 39 obel
38 40 obmc
39 41 obta
40 42 ogsl
41 43 oimea
42 44 pnao
43 45 qcat
44 46 riao
45 47 ribo
46 48 rimanum
47 49 rinap
48 50 saao
49 51 suhu
50 52 tcma
51 53 tsae
52 54 xcat

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

15
report.html Normal file
View File

@@ -0,0 +1,15 @@
<html>
<head>
<title>דו"ח התקדמות</title>
<style>
</style>
</head>
<body dir="rtl">
<h1>דו"ח התקדמות
<h2>מטרות
<p>מטרת הפרוייקט היא לייצר דרך למצוא קרבה או אינטראקסטואליות בין טקסטים שונים באכדית על מנת </p>
</h2>
</h1>
</body>
</html>

View File

@@ -6,4 +6,4 @@ import psycopg2
# conn = psycopg2.connect("dbname='dh' user='dh' host='dh.saret.tk' password='qwerty'")
# return conn
def
# def