Skip to main content
. 2024 Jan 31;10:e1821. doi: 10.7717/peerj-cs.1821
Algorithm 1: Feature extraction algorithm based on rules and opinion lexicon
Input: POS-tagged pre-processed sentence, feature-rule-lexicon, Opinion Lexicon
Output: Feature
Begin
1 for each POS-tagged-sentence “si” in POS-tagged sentences do
begin
2   while not (feature-rule-lexicon.eof)
begin
3     if (POS-tagged-sentence “si” matches rule in feature-rule-lexicon) then
begin
4     if (sentiment matches Opinion Lexicon) then
begin
5       Extract feature-sentiment N-gram along with rule # from feature-rule-lexicon
6      Store it in Feature-Opinion-Lexicon (L1)
End if
End If
End while
End for
End