Skip to content

Commit 7946f5a

Browse files
committed
feat: update readme for core use example.
1 parent d3f99fb commit 7946f5a

File tree

3 files changed

+59
-13
lines changed

3 files changed

+59
-13
lines changed

README.md

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,32 @@ pip install dingo-python
5151

5252
## Example Use Cases
5353

54-
### 1. Evaluate Local Text File (Plaintext)
54+
### 1. Using Evaluate Core
55+
56+
```python
57+
from dingo.config.config import DynamicLLMConfig
58+
from dingo.io.input.MetaData import MetaData
59+
from dingo.model.llm.detect_text_quality_detail import DetectTextQualityDetail
60+
from dingo.model.prompt.prompt_common import PromptRepeat
61+
from dingo.model.rule.rule_common import RuleEnterAndSpace
62+
63+
def llm():
64+
DetectTextQualityDetail.prompt = PromptRepeat()
65+
DetectTextQualityDetail.dynamic_config = DynamicLLMConfig(
66+
key='',
67+
api_url='',
68+
# model='',
69+
)
70+
res = DetectTextQualityDetail.call_api(MetaData(data_id='123', content="hello, introduce the world"))
71+
print(res)
72+
73+
def rule():
74+
data = MetaData(data_id = '', content = "hello, introduce the world")
75+
res = RuleEnterAndSpace().eval(data)
76+
print(res)
77+
```
78+
79+
### 2. Evaluate Local Text File (Plaintext)
5580

5681
```python
5782
from dingo.io import InputArgs
@@ -72,7 +97,7 @@ result = executor.execute()
7297
print(result)
7398
```
7499

75-
### 2. Evaluate Hugging Face Dataset
100+
### 3. Evaluate Hugging Face Dataset
76101

77102
```python
78103
from dingo.io import InputArgs
@@ -92,7 +117,7 @@ result = executor.execute()
92117
print(result)
93118
```
94119

95-
### 3. Evaluate JSON/JSONL Format
120+
### 4. Evaluate JSON/JSONL Format
96121

97122
```python
98123
from dingo.io import InputArgs
@@ -114,7 +139,7 @@ result = executor.execute()
114139
print(result)
115140
```
116141

117-
### 4. Using LLM for Evaluation
142+
### 5. Using LLM for Evaluation
118143

119144
```python
120145
from dingo.io import InputArgs

README_zh-CN.md

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,32 @@ pip install dingo-python
4040

4141
## 2. 使用示例
4242

43-
### 2.1 评估本地文本文件(纯文本)
43+
### 2.1 使用评估核心方法
44+
45+
```python
46+
from dingo.config.config import DynamicLLMConfig
47+
from dingo.io.input.MetaData import MetaData
48+
from dingo.model.llm.detect_text_quality_detail import DetectTextQualityDetail
49+
from dingo.model.prompt.prompt_common import PromptRepeat
50+
from dingo.model.rule.rule_common import RuleEnterAndSpace
51+
52+
def llm():
53+
DetectTextQualityDetail.prompt = PromptRepeat()
54+
DetectTextQualityDetail.dynamic_config = DynamicLLMConfig(
55+
key='',
56+
api_url='',
57+
# model='',
58+
)
59+
res = DetectTextQualityDetail.call_api(MetaData(data_id='123', content="hello, introduce the world"))
60+
print(res)
61+
62+
def rule():
63+
data = MetaData(data_id = '', content = "hello, introduce the world")
64+
res = RuleEnterAndSpace().eval(data)
65+
print(res)
66+
```
67+
68+
### 2.2 评估本地文本文件(纯文本)
4469

4570
```python
4671
from dingo.io import InputArgs
@@ -61,7 +86,7 @@ result = executor.execute()
6186
print(result)
6287
```
6388

64-
### 2.2 评估Hugging Face数据集
89+
### 2.3 评估Hugging Face数据集
6590

6691
```python
6792
from dingo.io import InputArgs
@@ -81,7 +106,7 @@ result = executor.execute()
81106
print(result)
82107
```
83108

84-
### 2.3 评估JSON/JSONL格式
109+
### 2.4 评估JSON/JSONL格式
85110

86111
```python
87112
from dingo.io import InputArgs
@@ -103,7 +128,7 @@ result = executor.execute()
103128
print(result)
104129
```
105130

106-
### 2.4 使用LLM进行评估
131+
### 2.5 使用LLM进行评估
107132

108133
```python
109134
from dingo.io import InputArgs

examples/core/score.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@ def llm():
1616
print(res)
1717

1818
def rule():
19-
data = MetaData(
20-
data_id = '',
21-
prompt = '',
22-
content = "hello, introduce the world"
23-
)
19+
data = MetaData(data_id = '', content = "hello, introduce the world")
2420
res = RuleEnterAndSpace().eval(data)
2521
print(res)
2622

0 commit comments

Comments
 (0)