将 uima ruta 中的某些实例的特征值设置为零
setting feature value to zero for some instance in uima ruta
我可以为 DZC_FigureCitation 注释设置特征值
目前我可以为图 1 匹配和设置特征值(章节=0 和部分)1.I还需要为图 1 匹配和设置特征值(章节=0 和部分)
示例输入:
Figure 1.1
Figure 1.2
Figure 1
Figure 2.3
Figure 2
脚本:
MayBeFigure (COLON|PERIOD)? NUM? (SPECIAL|PERIOD)? NUM{-> MARK(ChapterNumber,3),MARK(FigureNumber,5), MARK(FigureCitation, 1, 5),MARK(FIGURE,1)};
MayBeFigure{-PARTOF(FIGURE)} (COLON|PERIOD)? NUM{-PARTOF(ChapterNumber),-PARTOF(FigureCitation) -> MARK(FigureNumber,3),MARK(FigureCitation,1,3),MARK(FIGURE,1)};
BLOCK (foreach) FigureCitation {}
{
DECLARE DZC_FigureCitation(INT chapter,INT section);
ACTION FCC(INT chap,INT sect) = CREATE(DZC_FigureCitation, "chapter" = chap, "section" = sect);
INT Figchap=0;
INT Figsec;
(FIGURE (COLON|PERIOD)? ChapterNumber?{PARSE(Figchap)}(PERIOD|HYPHEN)? @FigureNumber{PARSE(Figsec)}){-PARTOF(DZC_FigureCitation),-PARTOF(DZC_SupplFigureCitation)-> FCC(Figchap,Figsec)};
}
预期输出:
Figure 1.1
chapter:1
section:1
Figure 1.2
chapter:1
section:2
Figure 1
chapter:0
section:1
Figure 2.3
chapter:2
section:3
Figure 2
chapter:0
section:2
收到输出:
Figure 1.1
chapter:1
section:1
Figure 1.2
chapter:1
section:2
Figure 1
chapter:1
section:1
Figure 2.3
chapter:2
section:3
Figure 2
chapter:2
section:2
MayBeFigure (COLON|PERIOD)? NUM? (SPECIAL|PERIOD)? NUM{-> MARK(ChapterNumber,3),MARK(FigureNumber,5), MARK(FigureCitation, 1, 5),MARK(FIGURE,1)};
MayBeFigure{-PARTOF(FIGURE)} (COLON|PERIOD)? NUM{-PARTOF(ChapterNumber),-PARTOF(FigureCitation) -> MARK(FigureNumber,3),MARK(FigureCitation,1,3),MARK(FIGURE,1)};
DECLARE DZC_FigureCitation(INT chapter,INT section);
ACTION FCC(INT chap,INT sect) = CREATE(DZC_FigureCitation, "chapter" = chap, "section" = sect);
BLOCK (foreach) FigureCitation {}
{
INT Figchap;
INT Figsec;
Document{->ASSIGN(Figchap,0)};
Document{->ASSIGN(Figsec,0)};
(FIGURE (COLON|PERIOD)? ChapterNumber?{PARSE(Figchap)}(PERIOD|HYPHEN)? @FigureNumber{PARSE(Figsec)}){-PARTOF(DZC_FigureCitation)-> FCC(Figchap,Figsec)};
}
UIMA Ruta 中的变量是全局的。您需要在最后一条规则之前重置块循环内的值:
Document{-> ASSIGN(Figchap,0),ASSIGN(Figsec,0)};
(FIGURE (COLON|PERIOD)? ChapterNumber?{PARSE(Figchap)}(PERIOD|HYPHEN)? @FigureNumber{PARSE(Figsec)}){-PARTOF(DZC_FigureCitation),-PARTOF(DZC_SupplFigureCitation)-> FCC(Figchap,Figsec)};
免责声明:我是 UIMA Ruta 的开发者
我可以为 DZC_FigureCitation 注释设置特征值
目前我可以为图 1 匹配和设置特征值(章节=0 和部分)1.I还需要为图 1 匹配和设置特征值(章节=0 和部分)
示例输入:
Figure 1.1
Figure 1.2
Figure 1
Figure 2.3
Figure 2
脚本:
MayBeFigure (COLON|PERIOD)? NUM? (SPECIAL|PERIOD)? NUM{-> MARK(ChapterNumber,3),MARK(FigureNumber,5), MARK(FigureCitation, 1, 5),MARK(FIGURE,1)};
MayBeFigure{-PARTOF(FIGURE)} (COLON|PERIOD)? NUM{-PARTOF(ChapterNumber),-PARTOF(FigureCitation) -> MARK(FigureNumber,3),MARK(FigureCitation,1,3),MARK(FIGURE,1)};
BLOCK (foreach) FigureCitation {}
{
DECLARE DZC_FigureCitation(INT chapter,INT section);
ACTION FCC(INT chap,INT sect) = CREATE(DZC_FigureCitation, "chapter" = chap, "section" = sect);
INT Figchap=0;
INT Figsec;
(FIGURE (COLON|PERIOD)? ChapterNumber?{PARSE(Figchap)}(PERIOD|HYPHEN)? @FigureNumber{PARSE(Figsec)}){-PARTOF(DZC_FigureCitation),-PARTOF(DZC_SupplFigureCitation)-> FCC(Figchap,Figsec)};
}
预期输出:
Figure 1.1
chapter:1
section:1
Figure 1.2
chapter:1
section:2
Figure 1
chapter:0
section:1
Figure 2.3
chapter:2
section:3
Figure 2
chapter:0
section:2
收到输出:
Figure 1.1
chapter:1
section:1
Figure 1.2
chapter:1
section:2
Figure 1
chapter:1
section:1
Figure 2.3
chapter:2
section:3
Figure 2
chapter:2
section:2
MayBeFigure (COLON|PERIOD)? NUM? (SPECIAL|PERIOD)? NUM{-> MARK(ChapterNumber,3),MARK(FigureNumber,5), MARK(FigureCitation, 1, 5),MARK(FIGURE,1)};
MayBeFigure{-PARTOF(FIGURE)} (COLON|PERIOD)? NUM{-PARTOF(ChapterNumber),-PARTOF(FigureCitation) -> MARK(FigureNumber,3),MARK(FigureCitation,1,3),MARK(FIGURE,1)};
DECLARE DZC_FigureCitation(INT chapter,INT section);
ACTION FCC(INT chap,INT sect) = CREATE(DZC_FigureCitation, "chapter" = chap, "section" = sect);
BLOCK (foreach) FigureCitation {}
{
INT Figchap;
INT Figsec;
Document{->ASSIGN(Figchap,0)};
Document{->ASSIGN(Figsec,0)};
(FIGURE (COLON|PERIOD)? ChapterNumber?{PARSE(Figchap)}(PERIOD|HYPHEN)? @FigureNumber{PARSE(Figsec)}){-PARTOF(DZC_FigureCitation)-> FCC(Figchap,Figsec)};
}
UIMA Ruta 中的变量是全局的。您需要在最后一条规则之前重置块循环内的值:
Document{-> ASSIGN(Figchap,0),ASSIGN(Figsec,0)};
(FIGURE (COLON|PERIOD)? ChapterNumber?{PARSE(Figchap)}(PERIOD|HYPHEN)? @FigureNumber{PARSE(Figsec)}){-PARTOF(DZC_FigureCitation),-PARTOF(DZC_SupplFigureCitation)-> FCC(Figchap,Figsec)};
免责声明:我是 UIMA Ruta 的开发者