[英]Search for an item in a text file using UIMA Ruta
我一直在嘗試搜索文本文件中存在的項目。
文本文件就像例如:
因此,我最初在字典中搜索XYZ並找到了位置,但是我只想要第一個XYZ ,而不想要其余的。 XYZ有一個屬性,該屬性將始終在5位代碼和文本MethondName之間 。
我做不到。
WORDLIST ZipList = 'Zipcode.txt';
DECLARE Zip;
Document
Document{-> MARKFAST(Zip, ZipList)};
DECLARE Method;
"MethodName" -> Method;
WORDLIST typelist = 'typelist.txt';
DECLARE type;
Document{-> MARKFAST(type, typelist)};
另外,我們如何在UIMA RUTA中使用REGEX?
有很多指定方法。 以下是一些示例(未經測試):
// just remove the other annotations (assuming type is the one you want)
type{-> UNMARK(type)} ANY{-STARTSWITH(Method)};
// only keep the first one: remove any annotation if there is one somewhere in front of it
// you can also specify this with POSISTION or CURRENTCOUNT, but both are slow
type # @type{-> UNMARK(type)}
// just create a new annotation in between
NUM{REGEXP(".....")} #{-> type} @Method;
在UIMA Ruta中有兩種使用正則表達式的選項:
"[A-Za-z]+" -> Type;
ANY{REGEXP("[A-Za-z]+")-> Type};
讓我知道是否不清楚。 然后,我將擴展描述。
免責聲明:我是UIMA Ruta的開發人員
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.