我可以设置DZC_FigureCitation注释的功能值
目前我能够匹配和设置特征值(章节和章节)图1.1。我还需要匹配和设置图1的特征值(章节= 0和部分)。
示例输入:
directive('typeaheadOpenOnFocus', function ($timeout) {
return {
require: 'ngModel',
link: function (scope, element, attr, ctrl) {
element.bind('click', function () {
var vv = ctrl.$viewValue;
ctrl.$setViewValue(vv ? vv+' ': ' ' );
$timeout(function(){ctrl.$setViewValue(vv ? vv : '');},10)
});
}
};
})
脚本:
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
答案 0 :(得分:0)
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)};
}
答案 1 :(得分:0)
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的开发者