Word POS
AB'C' NNP
DEF' CC
GH'I' NNP
JKL ' CD
MN'O' CG
DEF' CG
What happens when the same dictionary key has two different values(as above)? Then the word POS in the output may or may not be right, right? Is there a way to track that or prevent the wrong values from getting printed?
User Profile
Collapse
-
-
Yes....been trying....with no luck.. I saved the first file as a dictionary pair of words and their corresponding POS. Then the second file, i saved it as a list of Phrases, each phrase contained in a pair of square brackets.
Code:#!/usr/bin/python # -*- coding: utf-8 -*- import os, sys, UserDict file_encoding="utf-8" dictfile = file("pos-taged-corpus.txt","r")
Leave a comment:
-
Comparing somewhat irregular data, counting and printing!
Here's the problem:
Word POS
AB'C' NNP
DEF' CC
GH'I' NNP
JKL ' CD
MN'O' CG
->In this input the first column consists of words and the second column depicts the Parts Of Speech(POS) of each word. ' used as the syllabic boundary. So a word might be just one syllable or more than one syllables. [Our language does not have word boundaries just like in English... -
-
Confusion from executing multiple loops:
I have an input in the form (as given below) in a text file. I have to loop through the contents in between two '$-$-$-$' characters. This is done by splitting at '$-$-$-$'. To get the Output as shown in the format below I could achieve by splitting at newline and at '-' character and looping through. Problem is I cannot get the names iteratively like 1.lab, 2.lab, 3.lab for content b/w $-$-$-$. Couldn't apply the loops properly. Confused with the... -
dechen replied to Comparing words with the words in dictionary and getting the corresponding values?in PythonSpot on! Thank you very much bvdet . Dictionary look up will be easier from now on. Thanks again.Leave a comment:
-
dechen started a topic Comparing words with the words in dictionary and getting the corresponding values?in PythonComparing words with the words in dictionary and getting the corresponding values?
How do I compare words of sentences with a dictionary and get it's corresponding value.
e.g, This is the dictionary format.
WORD Pronunciation
try t-r-y-0|
test t-e-s-t-0|
Sentence list:
I try my best.
The knowledge test.
So for each word in the sentence must do dictionary lookup...
No activity results to display
Show More
Leave a comment: