ZoneTwelve
commited on
Commit
•
6c099c7
1
Parent(s):
93ec617
Update the data format.
Browse files- dataset/test.jsonl +0 -0
- dataset/train.jsonl +0 -0
- dataset/valid.jsonl +0 -0
- utils/functions/regular.py +4 -0
dataset/test.jsonl
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
dataset/train.jsonl
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
dataset/valid.jsonl
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
utils/functions/regular.py
CHANGED
@@ -9,9 +9,13 @@ def process(df: pd.DataFrame) -> pd.DataFrame:
|
|
9 |
|
10 |
def process_text(text):
|
11 |
matches = re.findall(pattern, text, re.DOTALL)
|
|
|
|
|
12 |
return dict(matches)
|
13 |
|
14 |
result = df['text'].apply(process_text)
|
|
|
|
|
15 |
return pd.DataFrame(result.tolist())
|
16 |
|
17 |
|
|
|
9 |
|
10 |
def process_text(text):
|
11 |
matches = re.findall(pattern, text, re.DOTALL)
|
12 |
+
# remove the 'system' in matches
|
13 |
+
matches = [(k, v) for k, v in matches if k != 'system']
|
14 |
return dict(matches)
|
15 |
|
16 |
result = df['text'].apply(process_text)
|
17 |
+
# remove the columns that named 'text' and 'system'
|
18 |
+
result = result.drop(columns=['text', 'system'])
|
19 |
return pd.DataFrame(result.tolist())
|
20 |
|
21 |
|