有限状态传感器级联的跟踪/采样运行

有限状态传感器级联的跟踪/采样运行

在自然语言处理 (NLP) 中,有限状态转换器 (FST) 的级联用于对形态过程进行建模。现在,我已经知道如何绘制 FST 的图形说明。例如,这里

但我想画一个图来描述 FST 如何处理特定输入。抱歉,我不确定这种图叫什么。我记得它要么被称为“跟踪”,要么被称为“样本运行”。但你可以在Jurafsky & Martin,语音和语言处理(本草案第66页图3.20)。

有人知道如何在乳胶中做到这一点吗?

答案1

只是为了好玩。

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,calc,fit,positioning,backgrounds,snakes,arrows.meta}
\tikzset{
letter/.style={draw,minimum width=0.7cm,minimum height=0.5cm,inner sep=0pt,anchor=center},
}
\begin{document}
\begin{tikzpicture}[font=\sf]
\node[letter] (lempty1) {~};
\node[letter,right=0cm of lempty1] (f1) {f};
\node[letter,right=0cm of f1] (o1) {o};
\node[letter,right=0cm of o1] (x1) {x};
\node[letter,right=0cm of x1] (N1) {+N};
\node[letter,right=0cm of N1] (P1) {+PL};
\node[letter,right=0cm of P1] (empty1) {~};
\begin{scope}[on background layer]
\draw[fill=blue!20!white,-] ($(lempty1.south west)+(-5mm,0)$) 
decorate [decoration={random steps,segment length=2pt,amplitude=1pt}] 
{to ($(lempty1.north west)+(-5mm,0)$)} -- ($(empty1.north east)+(5mm,0)$)
decorate [decoration={random steps,segment length=2pt,amplitude=1pt}] 
{to ($(empty1.south east)+(5mm,0)$)} -- cycle;
% curly brackets see https://tex.stackexchange.com/a/345234/121799
\end{scope}
%
\node[letter,below=2cm of lempty1] (lempty2) {~};
\node[letter,right=0cm of lempty2] (f2) {f};
\node[letter,right=0cm of f2] (o2) {o};
\node[letter,right=0cm of o2] (x2) {x};
\node[letter,right=0cm of x2] (hat2) {\raisebox{3pt}{$\wedge$}};
\node[letter,right=0cm of hat2] (s2) {s};
\node[letter,right=0cm of s2] (hash2) {\#};
\begin{scope}[on background layer]
\draw[fill=blue!20!white,-] ($(lempty2.south west)+(-5mm,0)$) 
decorate [decoration={random steps,segment length=2pt,amplitude=1pt}] 
{to ($(lempty2.north west)+(-5mm,0)$)} -- ($(hash2.north east)+(5mm,0)$)
decorate [decoration={random steps,segment length=2pt,amplitude=1pt}] 
{to ($(hash2.south east)+(5mm,0)$)} -- cycle;
% curly brackets see https://tex.stackexchange.com/a/345234/121799
\end{scope}
%
\node[letter,below=2cm of lempty2] (lempty3) {~};
\node[letter,right=0cm of lempty3] (f3) {f};
\node[letter,right=0cm of f3] (o3) {o};
\node[letter,right=0cm of o3] (x3) {x};
\node[letter,right=0cm of x3] (e3) {e};
\node[letter,right=0cm of e3] (s3) {s};
\node[letter,right=0cm of s3] (empty3) {~};
\begin{scope}[on background layer]
\draw[fill=blue!20!white,-] ($(lempty3.south west)+(-5mm,0)$) 
decorate [decoration={random steps,segment length=2pt,amplitude=1pt}] 
{to ($(lempty3.north west)+(-5mm,0)$)} -- ($(empty3.north east)+(5mm,0)$)
decorate [decoration={random steps,segment length=2pt,amplitude=1pt}] 
{to ($(empty3.south east)+(5mm,0)$)} -- cycle;
% curly brackets see https://tex.stackexchange.com/a/345234/121799
\end{scope}
%
\draw[double distance=5mm,{Straight Barb[length=2pt,width=7mm,open].}-{.Straight Barb[length=2pt,width=7mm,open]}]
($(o1)!0.7!(x1)-(0,0.4cm)$) -- ($(o2)!0.7!(x2)+(0,0.4cm)$)
node[midway,draw,fill=white] {LEXICON-FST};
%
\draw[double distance=5mm,{Straight Barb[length=2pt,width=7mm,open].}-{.Straight Barb[length=2pt,width=7mm,open]}]
($(o2)!0.7!(x2)-(0,0.4cm)$) -- ($(o3)!0.7!(x3)+(0,0.4cm)$)
node[midway,draw,fill=white,minimum width=4cm] (box2) {\begin{tabular}{c}
{\tiny orthographic rules}\\
$\bullet~\bullet~\bullet$
\end{tabular}};
\node[draw,fill=white] at (box2.west) {FST$_1$};
\node[draw,fill=white] at (box2.east) {FST$_n$};
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容