Skip to content

Commit c795f15

Browse files
committed
Add a sample code.
1 parent 444b32a commit c795f15

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Diff for: Automatic-Summarization/README.md

+24
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,30 @@ The `result_dict` is a dict. this format is as follows.
9696
}
9797
```
9898

99+
If you want to sort by the above scores that represent the degree of importance, use `numpy` or `pandas` to format the data, for example, as follows.
100+
101+
```python
102+
import pandas as pd
103+
import numpy as np
104+
105+
result_df = pd.DataFrame(
106+
np.c_[
107+
result_dict["summarize_result"],
108+
result_dict["scoring_data"]
109+
],
110+
columns=[
111+
"sentence",
112+
"index_key",
113+
"score"
114+
]
115+
).sort_values(
116+
by="score",
117+
ascending=False
118+
)[["sentence", "score"]]
119+
120+
print(result_df)
121+
```
122+
99123
## Usecase: Summarize Japanese string argument.
100124

101125
Import Python modules.

0 commit comments

Comments
 (0)