this format of text file want fetch text , headline please suggest me how it. i'm trying first convert text dataset can't getting success fetch text node value in text.
boxid{26027836} left{8.346457} top{14.296841} bottom{20.563504} right{12.952756} text{8.346457,14.819063,20.563504,12.952737 tika r pradhan kathmandu, january 24 central committee of ucpn-maoist has told party chairman pushpa kamal dahal present proposal revival of party. according senior leader haribol gajurel, 98 cc members have aired views @ ongoing cc meeting demanding new lease of life party. cc decided resume meeting on tuesday, giving party chief time present proposal on party restructuring. hiatus takes account legislature-parliament meeting slated monday. gajurel said discussions on fresh issues begin after chairman presents plan on tuesday. said dahal float plan party restructuring, adding plan cover ethics party’s rank , file should adhere to. cc meeting kicked off 8 days ago dwelt on political document dahal had presented. document has raised questions without bothering offer solutions. during today’s meeting, party leader renu chand pointed people have made negative comments chairman’s son prakash dahal. urged dahal remove son secretariat. krishna dhital, party leader gorkha, asked party leader narayan kaji shrestha explain why appointed lady personal secretary. eof9.000000} text{10.038215,15.732951,19.470202,12.834632 himalayan news service kathmandu, january 24 ucpn-maoist leaders have started discussions on selection of party’s parliamentary party leader. former vice-chairman baburam announcing not want hold political position @ least year, party chairman pushpa kamal dahal under pressure not stake claim on position. sources claimed dahal support close confidante krishna bahadur mahara position. since bhattarai against mahara, field close aide top bahadur rayamajhi position. former vice-chairman narayan kaji shrestha giriraj mani pokhrel. leaders close dahal claim dahal himself may take responsibility of pp leader if subordinates start quarrelling position. others party settle issue making mahara pp leader, rayamajhi deputy leader , pokhrel chief whip of pp. senior leader shrestha, however, said top leaders have not yet discussed selection of pp leader. said meeting of central office, begin tomorrow, begin discussions on issue. said options, including dahal , mahara’s pp leadership, open discussion. eof8.500000} headline{10.038215,15.013414,15.851079,12.834632 parliamentary party leadership in focus eof27.000000} headline{8.346457,14.296841,14.819063,12.952738 ucpn-m revival plan sought eof38.000000} boxid{25861210} left{11.161417} top{5.569194} bottom{5.680180} right{12.952756} text{11.161417,5.569194,5.680180,12.952756 tht eof5.000000} boxid{26027216} left{8.346287} top{8.552401} bottom{14.166286} right{10.314763} headline{8.346287,8.552401,9.727400,10.314763 tb patients jeopardising own lives eof29.000000} text{8.346287,9.727400,14.166286,10.314763 himalayan news service dipayal, january 24 tb patients in doti district have been playing own lives not adhering directly observed treatment shortcourse, intensive treatment method against tuberculosis. 8 months, medical personnel administer doses tb patients , perform health checkups. method proving ineffective in treating respiratory disease patients not bothering visit designated centres prescribed doses, says focal person , district public health officer, bhim prasad paudel. “we remind patients take medicine on time, pay no heed,” says. forty per cent of around 300 patients on dots have not been abiding rules. paudel blames on lack of adequate knowledge among patients dots , adverse consequences result non-adherence medication schedule. dpho chief mahendradhwaj adhikari says handful of patients approach designated hospitals treatment regularly. “in many cases, come @ last stage,” observes. eof9.000000}
something following should achieve you're looking for. solution i'm providing here transform data in source text xml. need modify i've provided meet requirements more specifically, following should give start.
string filecontents = file.readalltext("input.txt"); //your example source text in file string pattern = @"(.*)?\{([^}]+)\}"; matchcollection matches = regex.matches(filecontents, pattern, regexoptions.multiline); stringbuilder sb = new stringbuilder(); sb.appendline("<?xml version='1.0' encoding='utf-8'?>"); sb.appendline("<contents>"); foreach (match match in matches) { string nodename = match.groups[1].value; string nodevalue = match.groups[2].value; sb.appendformat("<{0}>{1}</{0}>", nodename.tolower(), nodevalue); sb.appendline(); } sb.appendline("</contents>"); file.writealltext("output.xml", sb.tostring()); the "input.txt" file contains source text. i'm using stringbuilder create xml string before dumping file, purposes of example. obviously, if need work xml after transformation, you'd want use xdocument (or xmldocument, depending on version of .net you're using). stringbuilder faster xdocument / xmldocument that's why i'm using create output xml file.
Comments
Post a Comment