# Named Entity Recognition Using Conditional Random Fields
## 4 Urdu NER Using Condition Random Fields
### Feature Functions  
Feature functions play a key role in the training phase, as they determine the feature values according to the feature templates presented in Table 4. That is, the feature values used for learning are generated by giving the training data as input to the feature functions.  
Two very different real-valued and binary-valued features can be used in CRFs; however, in our experiment all features were binary-valued. The overall volume of finalized features produced by the feature function all across the process of encoding depends significantly upon three aspects: (a) the quantity of the training data, (b) the range of class labels, and (c) the number of independent strings derived from a particular template. As discussed in the preceding subsection, this study used 11 templates and the number of output classes was seven. Thus, in the case of unigram templates, the number of feature functions generated by a template for a single token will be ((\(1\times 7\)) \(\times\) 11 = 77). Similarly, for a record with a total of 12 tokens, the number of features generated will be ((\(12\times 7\)) \(\times\) 12 = 1008)).  
For a formal specification, consider a given word token (WT) that is to be used as a feature template. \(|W_{T}|\) represents the length of the word, and four functions--\(\delta\), \(\beta\), \(\gamma\), and \(\eta\)--can be defined that determine the value of each element in the feature template. The definition of the four functions is presented in Equation (8) to Equation (11).  
\[P_{R}=\delta(W_{T})=\left\{\begin{array}{ll}U,&|W_{T}|=1\\ B,&|W_{T}|=2\end{array}\right. \tag{8}\]  
\[I_{D}=\beta(W_{T})=N+1 \tag{9}\]  
\[P_{S}=\gamma(W_{T})=\left\{\begin{array}{ll}C_{W}[0,&0],&\text{\em current word}\\ C_{W}[1,&0],&\text{\em pre-context}\\ C_{W}[1,&1],&\text{\em post-context}\end{array}\right. \tag{10}\]  
\[T_{G}=\eta(W_{T})=\left\{\begin{array}{ll}C_{W}[-1,&1],&\text{\em Pre-context POS Tag}\\ C_{W}[0,&1],&\text{\em current word POS Tag}\\ C_{W}[1,&1],&\text{\em post-context POS Tag}\end{array}\right. \tag{11}\]  
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline \multirow{2}{*}{**Feature Templates**} & \multicolumn{4}{c}{**Values of Elements**} & \multirow{2}{*}{**Description**} \\  & \multicolumn{1}{c}{**PR**} & \multicolumn{1}{c}{**ID**} & \multicolumn{1}{c}{**PS**} & \multicolumn{1}{c}{**TG**} & \multicolumn{1}{c}{**Description**} \\ \hline \(<\)U1:\%\(\propto\)[\(-1,0\)]\(>\) & U & 1 & \([-1,0]\) & - & Prior vocabulary term \\ \(<\)U2:\%\(\propto\)[\(0,0\)]\(>\) & U & 2 & \([0,0]\) & - & Present vocabulary term \\ \(<\)U3:\%\(\propto\)[\(1,0\)]\(>\) & U & 3 & \([1,0]\) & - & Succeeding vocabulary term \\ \(<\)U4:\%\(\propto\)[\(0,1\)]\(>\) & U & 4 & \([0,1]\) & - & Syntactic tag of the current word \\ \(<\)U5:\%\(\propto\)[\(-1,1\)]\(>\) & U & 5 & \([-1,1]\) & - & Syntactic tag of the preceding lexical word \\ \(<\)U6:\%\(\propto\)[\(1,1\)]\(>\) & U & 6 & \([1,1]\) & - & Syntactic tag of the succeeding lexical word \\ \(<\)U7:\%\(\propto\)[\(0,0\)]\%\(>\) & U & 7 & \([0,0]\) & \([0,1]\) & Current word/current syntactic tag \\ \(<\)U8:\%\(\propto\)[\(0,0\)]\%\(\propto\)[\(1,1\)]\(>\) & U & 8 & \([0,0]\) & \([1,1]\) & Current word/next syntactic tag \\ \(<\)U9:\%\(\propto\)[\(0,0\)]\%\(\propto\)[\(-1,1\)]\(>\) & U & 9 & \([0,0]\) & \([-1,1]\) & Current word/previous syntactic tag \\ \(<\)B10:\%\(\propto\)[\(0,1\)]\(>\) & B & 10 & - & \([0,1]\) & Bigram of the current syntactic tag \\ \(<\)B11:\%\(\propto\)[\(0,0\)]\(>\) & B & 11 & - & \([0,0]\) & Bigram of the current word \\ \hline \hline \end{tabular}
\end{table}
Table 4: Details of the Feature Templates.