In: Computer Science
pseudo-code, please
If a word has a tag O, it means that the word has nothing to do with the named entity (it is not a part of a named entity such as a location, person name, organization, and etc.)
If a word has a tag starting with B, it means that the word is the beginning of a named entity. For instance, the tag B-per means that the associated word is the beginning of a person's name. On the other hand, if a word has a tag starting with I, it means the word is inside a named entity. Hence, the tag I-per means that the associated word is inside a person's name.
Thousands O
of O
demonstrators O
have O
marched O
through O
London B-geo
Take the following lines in the file for example.
President B-per
Mahmoud I-per
Ahmadinejad I-per
said O
We know the words “President, Mahmoud, and Ahmadinejad” cover a named entity of the type person name.
Could you write pseudo code to pull the names out of a file that are stated in the example
Pseudocode:
Pseudocode in simple terms is step by step explanation of a program or arranging the sequence of tasks :
Here we have made use of If-Else as well as switch-case statement structure :
pseudocode for given scenario:
Using If-Else:
Begin
Input a word
If Word has Tag=”O”
“Not a part of named Entity”
ElseIf Word has Tag=”B”
“word is the beginning of a named entity”
ElseIf Word has Tag=”B-per”
“associated word is the beginning of a person's name’
ElseIf Word has Tag =”I”
“Word is inside named entity”
Else //( Word has Tag =”I-Per”)
“associated word is inside a person's name.”
End If
End
Using Switch case:
Begin
Input word(names out of file)
Case based on tag
Case=”O”
Report “Not a part of named Entity”
Case=”B”
Report “word is the beginning of a named entity”
Case=”B-per”
Report “associated word is the beginning of a person's name’
Case=”I”
Report “Word is inside named entity”
Case=”I-per”
Report “associated word is inside a person's name.”
End Case
End
I hope this will help, if not please comment below i will help you.
Please do not forget to Upvote the answer!!
Happy Learning!!