in reply to Re: VarStructor II -- Abbreviation tool
in thread VarStructor II -- Abbreviation tool
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
3Re: VarStructor II -- Abbreviation tool
by jeffa (Bishop) on Jun 01, 2004 at 15:31 UTC | |
No. There is every need to speculate with your code, Wassercrats. My code was not meant to replace yours, or even reproduce 100% of the functionality. It was to show you that you can do what you are trying to do with much less code! How about this instead: it truncates the string to the first two letters (lowercased) and adds incremented numbers for each collision. And this time i won't require you to use a module! Of course, while i find this to be quite silly -- it is more intuitive than what you have. Besides, you already have your arguable better way. jeffa L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat) | [reply] [d/l] |
| |
|
Re: Re: Re: VarStructor II -- Abbreviation tool
by jdporter (Paladin) on Jun 02, 2004 at 14:42 UTC | |
reduce to but the lines reduce to I mean, I understand that the latter are treated differently because they're identical within the Max_Length span, whereas the shorter ones aren't. But still... why should that matter? Wouldn't it have been acceptable -- aye, preferable -- to have the latter reduce to (e.g.)
??? Thanks,jdporter | [reply] [d/l] [select] |
by Wassercrats (Initiate) on Jun 02, 2004 at 15:17 UTC | |
Line one reduces to: Line_o and: Lines end here not reduces to: L1 The script is intended to create the shortest possible unique string, with a given maximum number of characters from the beginning of the string. When two strings are identical, a number must be appended and since the text is of no use in distinguishing those strings, and the shortest possible unique string contains just one (actually, zero) characters, that's how many characters are kept. Whether sticking to that produces the most useful function is another issue, but it does produce the shortest string and puts value on the inclusion of text when the text isn't identical. I will be adding an option to have identical text that's appended with a number contain the maximum number of characters instead of just one. | [reply] |
by jdporter (Paladin) on Jun 02, 2004 at 15:51 UTC | |
You got the output example backwards.So I did. Ack! But you got the jist of my question. Whether sticking to that produces the most useful function is another issue, but it does produce the shortest string and puts value on the inclusion of text when the text isn't identical. Ah. Interesting. It sounds like there is essentially a trade-off to be made, between shortest possible and inclusion of meaningful text. I guess I would tend to weight the latter more heavily than you did. Either that, or not at all, which is (I believe) what Text::Abbrev does. Here's my solution which gives absolute priority to inclusion of meaningful text. It doesn't maximize compression of strings such as xxxxxxxxxx the way yours does, but I'm viewing those as unlikely input. For "meaningful" text such as Four score..., the results are satisfactory (IMHO).
| [reply] [d/l] [select] |