-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjust_prep.py
31 lines (24 loc) · 1003 Bytes
/
just_prep.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from welder.node import InputPipe, OutputPipe, ConcatJoin
from welder.pipe.models import BertBoolQ
from welder.pipe.htmlparser import HTMLContext2Lines, HTMLTable2Lines
from welder.pipe.linespre_processor import Lower, RemoveUnwantedChars, RemoveSpaces, WordThreshold, SplitIntoSentences
from welder.pipe.db import Chunk2Faiss
from welder.pipe.retriever import DenseRetrieverFS
from welder.pipeline import PipeLine
import json
PL = PipeLine()
PL.sequential_connect([
InputPipe('Input 1', inputs=[str, list], fix_inputs=2),
HTMLContext2Lines('HTML Context 2 Lines'),
HTMLTable2Lines('HTML Table 2 Lines', drop_HTML=True),
RemoveUnwantedChars('Remove Unwanted Chars'),
WordThreshold('Word Threshold'),
RemoveSpaces('Remove Spaces'),
SplitIntoSentences('split into sentences'),
Lower('Lower'),
OutputPipe('OutPut 1', check=False)
])
with open(r'demo\data\0.json', 'rb') as f:
content = json.load(f)['content']
results = PL.flow([[content, []]])
print(results)