SentiPers Reader
This module includes classes and functions for reading the SentiPers corpus.
SentiPers contains a collection of Persian texts with semantic labels.
SentiPersReader
¶
This class includes functions for reading the SentiPers corpus.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
str
|
Path to the folder containing the corpus files. |
required |
__init__(root)
¶
Initializes the SentiPers reader.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
str
|
Path to the folder containing the corpus files. |
required |
comments()
¶
Yields comments belonging to each document.
Examples:
>>> sentipers = SentiPersReader(root='sentipers')
>>> next(sentipers.comments())[0][1]
'بيشتر مناسب است براي کساني که به دنبال تنوع هستند و در همه چيز نو گرايي دارند .'
Yields:
| Type | Description |
|---|---|
list[list[str]]
|
A list of comments for the next document, where each comment is a list of its sentences. |
docs()
¶
Yields documents from the SentiPers corpus.
Each document is returned as a dictionary containing these fields: - Title - Type - comments: A list of comment dictionaries.
Each dictionary in the comments list includes:
- id
- type
- author
- value
- sentences: A list of sentence dictionaries (text, id, value).
Yields:
| Type | Description |
|---|---|
dict[str, Any]
|
The next document in the corpus. |