World: r3wp
[Parse] Discussion of PARSE dialect
older newer | first last |
Graham 1-Jul-2006 [1189x4] | but people don't use them when typing. |
SNOMED CT is the one being currently promulgated | |
and there's the proprietary MEDCIN | |
so, personal shorthand should expand into a controlled vocab ideally | |
Tomc 1-Jul-2006 [1193] | yes |
Graham 1-Jul-2006 [1194] | Ii Type II Diabetes #250.00 here the macro expansion includes a code (CPT) from the AMA. |
Tomc 1-Jul-2006 [1195] | and the macros should also be part of that ontology |
Graham 1-Jul-2006 [1196x2] | Medcin contains over 100,000 clinical propositions |
no one is going to remember that! | |
BrianH 1-Jul-2006 [1198] | Can you make sure that no whitespace sneaks into your macro names? |
Graham 1-Jul-2006 [1199] | tom, I can't force the guy to change his macros! |
Tomc 1-Jul-2006 [1200x2] | no that is what browaers are for |
right | |
BrianH 1-Jul-2006 [1202] | I mean at the beginning. |
Graham 1-Jul-2006 [1203x2] | there is no whitespace inside a macroname |
LOINC, another controlled vocab, contains over 30,000 items. | |
Tomc 1-Jul-2006 [1205] | so there is a seperate extendable file with the macro=expansion |
Graham 1-Jul-2006 [1206x2] | tom, yes. |
actually the file will be saved in a database and loaded when the program starts | |
BrianH 1-Jul-2006 [1208] | Make sure to trim the names before you use them. I am rewriting your function. |
Graham 1-Jul-2006 [1209] | Tom, what exactly are you involved in ? |
Tomc 1-Jul-2006 [1210x2] | zebrafish |
as a model orginism | |
Graham 1-Jul-2006 [1212] | fish! |
Tomc 1-Jul-2006 [1213] | http://zfin.org |
Graham 1-Jul-2006 [1214x5] | Ok, I understand the need for an ontology here. |
but medicine is full of uncontrolled words which are in common use. | |
and the ontologically controlled programs are very expensive due to licensing fees | |
The AMA charge to use their codes, the American College of Pathologists charge to use their SMOMED-CT codes .. and so it goes on. | |
LOINC, from the Univ. of Indiana has open sourced their codes. | |
Tomc 1-Jul-2006 [1219x4] | ahh my mind is corrupted by giving everything away I forget that that is not what everyone does |
so back to your problem I | |
seems it will take n passes | |
where n is the # of macros. | |
BrianH 1-Jul-2006 [1223x3] | expand-macros: func [data [string!] macros [block!] /local whitespace macro-rule macro here there ] compose [ whitespace: (charset " ^/") macro-rule: make block! length? macros foreach [macro expansion] macros [ macro-rule: insert insert macro-rule macro '| ] macro-rule: head remove back macro-rule parse/all data [some [ here: copy macro macro-rule there: [whitespace | end] ( there: change/part here select/skip macros macro 2 there ) :there | skip ]] macro-rule: none data ] |
Sorry, need to change the settings in my editor. | |
expand-macros: func [data [string!] macros [block!] /local whitespace macro-rule macro here there ] compose [ whitespace: (charset " ^/") macro-rule: make block! length? macros foreach [macro expansion] macros [ macro-rule: insert insert macro-rule macro '| ] macro-rule: head remove back macro-rule parse/all data [some [ here: copy macro macro-rule there: [whitespace | end] ( there: change/part here select/skip macros macro 2 there ) :there | skip ]] macro-rule: none data ] | |
Graham 1-Jul-2006 [1226] | my first effort makes n passes ... |
Tomc 1-Jul-2006 [1227] | that the macro-expansoion fioe needs to self check for incidental occurances of a "macro" in an "expansion" and protect against |
BrianH 1-Jul-2006 [1228x2] | This will make one pass. |
And it won't have the problem you mention Tomc. | |
Tomc 1-Jul-2006 [1230] | in one pass you can jump over the expansion |
BrianH 1-Jul-2006 [1231] | My code does that. |
Graham 1-Jul-2006 [1232x2] | Pretty neat ... |
Parse is somewhat beyond my skills! | |
Tomc 1-Jul-2006 [1234] | I wouls still sort the macros by longest to shortest so cant glob on to part of a macro .. |
Graham 1-Jul-2006 [1235] | so, basically you created a single parse rule from the macro list and then parsed the text in one go. |
Tomc 1-Jul-2006 [1236] | but if you include the trailing white space that should be avoided |
BrianH 1-Jul-2006 [1237] | Tomc, that is a good point - I'll fix it. Graham, that's right. |
Graham 1-Jul-2006 [1238] | Did you compose that without any testing? :) |
older newer | first last |