使用Ruta,我正在尝试从文本文件中提取数据。我尝试了几种方法,但无法获得所需的确切信息。我需要从缩进的文本文件中获取借款人名称。
示例:
Borrower Name: Alice SSN: 000-00-000
Co-Borrower Name: SSN:
我注释了“借款人姓名”关键字和“ SSN”关键字,但无法弄清楚获取姓名的查询。
Document{->RETAINTYPE(SPACE)};
DECLARE BorrowerKeyword, NameKeyword, BorrowerNameKeyword;
W{REGEXP("Borrower")->BorrowerKeyword};
W{REGEXP("Name")->NameKeyword};
(SPACE BorrowerKeyword SPACE NameKeyword){-> BorrowerNameKeyword};
DECLARE SSNKeyword;
W{REGEXP("SSN")->SSNKeyword};
DECLARE BorrowerNameLine;
Line{CONTAINS(BorrowerNameKeyword,10,100),
CONTAINS(SSNKeyword,10,50)-> MARK(BorrowerNameLine)}; // Not able to annotate BorrowerNameLine
// other way but that also didn't work.
DECLARE BorrowerName;
RETAINTYPE(SPACE);
CW.ct=="Borrower" CW.ct=="Name" COLON n:W{-> CREATE(BorrowerName, "label"="Borrower Name", "value"=n.ct)};
RETAINTYPE;
请提出我错过的内容并纠正查询
答案 0 :(得分:0)
尝试在使用后滤除 Name Book Age
0 John B1 25
1 John B2 25
2 John B1 25
3 Paul B3 18
4 Paul B4 18
5 Jimmy B3 28
,以避免产生任何不良影响并简化规则制定过程。
SPACE