Prev: deleting error
Next: Off Topic -- Leukemia Fund raiser
From: Richard Owlett on 30 Jan 2010 07:22 PaulWalton wrote: > On Jan 28, 6:53 pm, Richard Owlett <rowl...(a)pcnetinc.com> wrote: >> http://wiki.tcl.tk/11020provides most of what I'm looking for. >> I have minimal experience with TCL and just getting my feet wet >> with XML. >> >> The data I'm attempting to parse comes from openstreetmap.org. >> This exercise is _PRIMARILY_ for learning more of *TCL* and *XML*. >> >> After looking at the output of the code at wiki.tcl.tk/11020, It >> would appear straight forward to extract just the information of >> interest (node lat/lon, nodes in a way). >> >> My question. It appearing so straight forward makes me think >> there should already be tools to extract related information from >> an XML file. Is there? Am I on the right track? > > If you don't want to use a catch-all xml parser and you know what to > expect in the xml file, then you can write some code to parse out > exactly what you want. To me this is simpler and more reliable than > using an extension because the data might not be perfectly valid xml > or the parser might be imperfect. > > set token [http::geturl "http://site.org/file.xml"] > set data [http::data $token] > http::cleanup $token > > > And if $data looks something like this: > > <lattitude>30°12′50″N</lattitude> > <longitude>92°01′46″W</longitude> > <otherstuff>abc123</otherstuff> > > > Then you can do this: > > set index [string first {<lattitude>}] > incr index 11 > set end [string first {</lattitude>} $index] > incr end -1 > set lattitude [string range $data $index $end] > > > You can also use regular expressions... Last time I attacked my underlying problem (~ year ago), I attempted a similar approach. It was pointed out that there were XML parsers in Tcl. This time I started out looking for a simpple to apply parser and was pointed to tDOM. I'm working through the portion of the tutorial at http://wiki.tcl.tk/8984 which applies to my _current_ goal(s). If you think that was circuitous, I got here by considering improvements to speech recognition ;/
From: Alexandre Ferrieux on 30 Jan 2010 09:50 On Jan 30, 1:22 pm, Richard Owlett <rowl...(a)pcnetinc.com> wrote: > > If you think that was circuitous, I got here by considering > improvements to speech recognition ;/ Curiosity aroused. Care to elaborate ? -Alex
From: Richard Owlett on 31 Jan 2010 09:40 Alexandre Ferrieux wrote: > On Jan 30, 1:22 pm, Richard Owlett <rowl...(a)pcnetinc.com> wrote: >> If you think that was circuitous, I got here by considering >> improvements to speech recognition ;/ > > Curiosity aroused. Care to elaborate ? > > -Alex You asked ;) Foundation laid ~40 years ago when I completed ~3 yrs towards a BSEE, was 5 yr program at the time. Being a lousy typist, I thought speech recognition would be way to go for entering program code. Back in 70's I had known a MIT post-doc doing non real time discrete speech recognition using 1/2 of resources on a DEC KL-10 and assumed progress had been made since. When looking for software, I discovered that the large vocabulary products were so optimized for continuous speech they were not recommended for discrete speech. The reasons given just didn't make sense to me so I started chasing references on the web. Those references made use on sonograms of format similar to http://en.wikipedia.org/wiki/File:Spectrogram-19thC.png . I was more accustomed to displays such as http://en.wikipedia.org/wiki/File:My_Songo_Real_Time_Analysis.ogg I did some work in Scilab aiming at a plot similar to http://en.wikipedia.org/wiki/File:Spectrogram.png That led to investigating Tcl/Tk for menus. To write the program I had to learn something about FFT's and their limitations. (Cooley and Tukey were just publishing when I left school). Now speech is a very complex signal. To find some bird song recordings I contacted some birders. That led to conversations with someone who collates and plots yearly humming bird migrations. The mechanics of his plotting routine seemed cumbersome. I had heard of the "Open Street Map" project and suspected that some of its tools could be used. Think of "first sighting" as POI. It proved cumbersome it its own way. But it did have did have the raw data describing political and geographical features of interest. That led to a newbie attempt to parse XML with regexp ;< Lost interest in project for a year. During last attempt I was told that Tcl could parse XML. A wiki search turned up a promising page, http://wiki.tcl.tk/11020 . That led to a fruitful recommendation to use tDOM. The tutorial at http://wiki.tcl.tk/8984 is giving most of the information I'm looking for. Unfortunately its more oriented to writing/modifying an XML than being a general purpose data extractor. As soon as I understand how to get values associated with specific nodes and their attributes I'll have something to show for my efforts. One of the benefits of retirement is chasing interesting rabbit trails. As I said, you *DID* ask ;>
From: Uwe Klein on 31 Jan 2010 10:04 Richard Owlett wrote: > Being a lousy typist, I thought speech recognition would be way to go > for entering program code. I fixed that with a professional touch typing course when I was 16 ;-) I have used single word recognition to trigger measuring cycles and signal injection. ( Motie help while having my human hands with scope probes deep inside some instrument ) uwe
From: Richard Owlett on 31 Jan 2010 10:36
Uwe Klein wrote: > Richard Owlett wrote: >> Being a lousy typist, I thought speech recognition would be way to go >> for entering program code. > > I fixed that with a professional touch typing course when I was 16 ;-) Attempted touch typing in high school summer session about that age. Had only a old Smith-Corona portable (strictly mechanical- not sure if electrics such as IBM Selectric were even available then) to practice with. Last time I checked, the local community college didn't have a course focused strictly on the mechanics of typing straight text. Time to check again? > > I have used single word recognition to trigger > measuring cycles and signal injection. > ( Motie help while having my human hands with > scope probes deep inside some instrument ) > > uwe |