Note that there are some explanatory texts on larger screens.

plurals
  1. POprogram that read file and extract word without # in C#
    primarykey
    data
    text
    <p>i read a file and file format is this<br> <strong>INPUT FILE FORMAT</strong></p> <pre><code> id PosScore NegScore Word SynSet 00002098 0 0.75 unable#1 (usually followed by `to') not having the necessary means or skill or know-how; "unable to get to town without a car"; "unable to obtain funds" 00002312 0.23 0.43 dorsal#2 abaxial#1 facing away from the axis of an organ or organism; "the abaxial surface of a leaf is the underside or side facing away from the stem" 00002527 0.14 0.26 ventral#2 adaxial#1 nearest to or facing toward the axis of an organ or organism; "the upper side of a leaf is known as the adaxial surface" 00002730 0.45 0.32 acroscopic#1 facing or on the side toward the apex 00002843 0.91 0.87 basiscopic#1 facing or on the side toward the base 00002956 0.43 0.73 abducting#1 abducent#1 especially of muscles; drawing away from the midline of the body or from an adjacent part 00003131 0.15 0.67 adductive#1 adducting#1 adducent#1 especially of muscles; bringing together or drawing toward the midline of the body or toward an adjacent part in this file </code></pre> <p>in this file the Synset column should be delete and second thing if the Word column have more than one word then the id, PosScore, NegScore will be repeat according to word repeat in a line but the id , posScore,NegScore will be same. i want the following output of the above file<br> <strong>OUTPUT</strong> </p> <pre><code> id PosScore NegScore Word 00002098 0 0.75 unable#1 00002312 0.23 0.43 dorsal#2 00002312 0.23 0.43 abaxial#1 00002527 0.14 0.26 ventral#2 00002527 0.14 0.26 adaxial#1 00002730 0.45 0.32 acroscopic#1 00002843 0.91 0.87 basiscopic#1 00002956 0.43 0.73 abducting#1 00002956 0.43 0.73 abducent#1 00003131 0.15 0.67 adductive#1 00003131 0.15 0.67 adducting#1 00003131 0.15 0.67 adducent#1 </code></pre> <p>i write the following code but it give unexpected result. </p> <pre><code> TextWriter tw = new StreamWriter("D:\\output.txt"); private void button1_Click(object sender, EventArgs e) { StreamReader reader = new StreamReader(@"C:\Users\Zia Ur Rehman\Desktop\records.txt"); string line; String lines = ""; while ((line = reader.ReadLine()) != null) { String[] str = line.Split('\t'); String[] words = str[4].Split(' '); for (int k = 0; k &lt; words.Length; k++) { for (int i = 0; i &lt; str.Length; i++) { if (i + 1 != str.Length) { lines = lines + str[i] + ","; } else { lines = lines + words[k] + "\r\n"; } } } } tw.Write(lines); tw.Close(); reader.Close(); } </code></pre> <p>this code give the following result which is wrong </p> <pre><code>00002098,0,0.75,unable#1,unable#1 00002312,0,0,dorsal#2 abaxial#1,dorsal#2 00002312,0,0,dorsal#2 abaxial#1,abaxial#1 00002527,0,0,ventral#2 adaxial#1,ventral#2 00002527,0,0,ventral#2 adaxial#1,adaxial#1 00002730,0,0,acroscopic#1,acroscopic#1 00002843,0,0,basiscopic#1,basiscopic#1 00002956,0,0,abducting#1 abducent#1,abducting#1 00002956,0,0,abducting#1 abducent#1,abducent#1 00003131,0,0,adductive#1 adducting#1 adducent#1,adductive#1 00003131,0,0,adductive#1 adducting#1 adducent#1,adducting#1 00003131,0,0,adductive#1 adducting#1 adducent#1,adducent#1 </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload