kakooch commited on
Commit
74c6a73
·
1 Parent(s): a191706

Upload 2 files

Browse files
Files changed (2) hide show
  1. README.md +67 -2
  2. persian_poetry-qa.py +40 -0
README.md CHANGED
@@ -1,3 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
- license: gpl-2.0
3
- ---
 
1
+
2
+ # Persian Poetry Dataset
3
+
4
+ ## Dataset Description
5
+
6
+ ### Overview
7
+
8
+ This dataset contains a collection of Persian poems structured in a question-answering format. The dataset is derived from various Persian poets and their poems, providing a rich source for exploring Persian poetry in a structured manner suitable for machine learning applications, especially in natural language processing tasks like question answering.
9
+
10
+ ### Data Collection
11
+
12
+ - **Data Collection Source:** The data is sourced from the [Ganjoor project](https://github.com/ganjoor/). The specific database file can be found in the [releases section](https://github.com/ganjoor/desktop/releases/tag/v2.81) of their GitHub repository.
13
+ - **Time Period:** Oct-12-2023
14
+ - **Collection Methods:** The data was collected by downloading the raw database file from the Ganjoor project's GitHub repository.
15
+
16
+ ### Data Structure
17
+
18
+ The dataset is structured into a CSV file with the following columns:
19
+ - `context`: A static string which is "Persian Poetry or شعر فارسی".
20
+ - `question`: A string that asks for a sample poem from a specific poet in the format "یک نمونه از شعر [POET_NAME]".
21
+ - `answer`: Text of a hemistich or verse.
22
+ - `answer_start`: The starting character index of `answer` within `context` (Note: this is always -1 in the current dataset as `answer` is not a substring of `context`).
23
+
24
+ ### Data Example
25
+
26
+ ```plaintext
27
+ context,question,answer,answer_start
28
+ Persian Poetry or شعر فارسی,یک نمونه از شعر Hafez,"The sun's eye has tears, and it's from separation’s pain", -1
29
+ ```
30
+
31
+ ## Dataset Usage
32
+
33
+ ### Use Cases
34
+
35
+ This dataset can be utilized for various Natural Language Processing and analysis tasks related to Persian poetry, such as:
36
+ - Question Answering
37
+ - Text Generation
38
+ - Language Modeling
39
+ - Style Analysis
40
+
41
+ ### Challenges & Limitations
42
+
43
+ - The `answer_start` field is always -1 as the `answer` is not a substring of `context`. Depending on your use-case, you might need to adjust how `context` and `answer_start` are determined.
44
+ - The dataset might contain long verses that are over 100 characters.
45
+
46
+ ### License
47
+
48
+ GPL (GNU General Public License)
49
+
50
+ ## Additional Information
51
+
52
+ ### Citation
53
+
54
+ ```
55
+ Persian Poetry Dataset. Collected by Kakooch from the Ganjoor Project. Available at: https://huggingface.co/datasets/persian_poetry
56
+ ```
57
+
58
+ ### Dataset Link
59
+
60
+ [Download the dataset from Hugging Face](https://huggingface.co/datasets/persian_poetry)
61
+
62
+ ### Contact
63
+
64
+ Email: [[email protected]](mailto:[email protected]) | GitHub: [kakooch](https://github.com/kakooch)
65
+
66
  ---
67
+
68
+ *This README was generated by Kakooch.*
persian_poetry-qa.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ from datasets import DatasetBuilder, SplitGenerator, Split, Features, Value
3
+
4
+ class PersianPoetry(DatasetBuilder):
5
+ VERSION = "1.0.0"
6
+
7
+ def _info(self):
8
+ return datasets.DatasetInfo(
9
+ description="This dataset contains a rich collection of Persian poems along with metadata about the poets and the verses.",
10
+ features=Features({
11
+ 'context': Value('string'),
12
+ 'question': Value('string'),
13
+ 'answer': Value('string'),
14
+ 'answer_start': Value('int32'),
15
+ }),
16
+ homepage="https://github.com/ganjoor/desktop/releases/tag/v2.81",
17
+ citation="""Persian Poetry Dataset. Collected by Kakooch from the Ganjoor Project. Available at: https://huggingface.co/datasets/persian_poetry""",
18
+ )
19
+
20
+ def _split_generators(self, dl_manager):
21
+ # Path to your CSV file
22
+ csv_path = poems-qa.csv"
23
+ return [
24
+ SplitGenerator(
25
+ name=Split.TRAIN,
26
+ gen_kwargs={
27
+ "filepath": csv_path
28
+ }
29
+ ),
30
+ ]
31
+
32
+ def _generate_examples(self, filepath):
33
+ df = pd.read_csv(filepath)
34
+ for idx, row in df.iterrows():
35
+ yield idx, {
36
+ 'context': row['context'],
37
+ 'question': row['question'],
38
+ 'answer': row['answer'],
39
+ 'answer_start': row['answer_start'],
40
+ }