Lyrics & Knowledge Personal Pages Record Shop Auction Links Radio & Media Kids Membership Help
The Mudcat Cafesj

Post to this Thread - Sort Descending - Printer Friendly - Home


BS: Computer folk: Can this even be done?

GUEST 21 Oct 15 - 04:34 PM
Jack Campin 21 Oct 15 - 04:50 PM
GUEST 21 Oct 15 - 04:59 PM
Dave the Gnome 21 Oct 15 - 05:07 PM
Dave the Gnome 21 Oct 15 - 05:11 PM
Nick 21 Oct 15 - 06:26 PM
Joe_F 21 Oct 15 - 06:29 PM
Mr Red 22 Oct 15 - 05:27 AM
McGrath of Harlow 22 Oct 15 - 09:43 AM
Jack Campin 22 Oct 15 - 10:17 AM
Bert 22 Oct 15 - 04:32 PM
GUEST 23 Oct 15 - 03:48 AM
Mr Red 23 Oct 15 - 04:26 AM
Bonzo3legs 23 Oct 15 - 07:24 PM
GUEST,Mr Red down at the local library 24 Oct 15 - 08:27 AM
Jack Campin 24 Oct 15 - 09:01 AM
Dave the Gnome 24 Oct 15 - 09:16 AM
Mr Red 24 Oct 15 - 11:28 AM
Mr Red 24 Oct 15 - 11:33 AM
Nick 25 Oct 15 - 08:42 AM
DMcG 25 Oct 15 - 08:50 AM

Share Thread
more
Lyrics & Knowledge Search [Advanced]
DT  Forum Child
Sort (Forum) by:relevance date
DT Lyrics:





Subject: BS: Computer folk: Can this even be done?
From: GUEST
Date: 21 Oct 15 - 04:34 PM

I have a word list (~1500 words, in English). Each word also has a unique number associated with it.

For example:

Tree    892

I have a file just with numbers. I need to turn them into their corresponding words. Word-by-word, number-by-number is just too time intensive given the amount that needs to be substituted.

Is there a way to easily translate from word to number / number to word?

Why? Simplify part of a step in a data-entry project.


Post - Top - Home - Printer Friendly - Translate

Subject: RE: BS: Computer folk: Can this even be done?
From: Jack Campin
Date: 21 Oct 15 - 04:50 PM

Use one of the Unix text processing utilities like awk or perl. You can use those from the Terminal in MacOS or whatever command shell windows Linux has.

And get a real name.


Post - Top - Home - Printer Friendly - Translate

Subject: RE: BS: Computer folk: Can this even be done?
From: GUEST
Date: 21 Oct 15 - 04:59 PM

Ouch Jack. But thanks.


Post - Top - Home - Printer Friendly - Translate

Subject: RE: BS: Computer folk: Can this even be done?
From: Dave the Gnome
Date: 21 Oct 15 - 05:07 PM

Yep. Put the whole list into a text file called, for instance, filea. I would suggest using rcp or ftp to transfer it to a UNIX or Linux box if it is currently on a PC. Put the number or words you want to translate into another file, fileb. Use something like

for x in $(cat fileb)
do
grep $x filea
done

It will give you a list of the number/word combinations based on the single strings in fileb. If you want to get a bit more clever you can use awk or cut to give you just the string in column 1 or 2.

Any more information can be obtained on a consultancy basis. Very reasonable daily rates...

:D


Post - Top - Home - Printer Friendly - Translate

Subject: RE: BS: Computer folk: Can this even be done?
From: Dave the Gnome
Date: 21 Oct 15 - 05:11 PM

Alternatively, if you are totally 'X' averse. Just paste the whole lot into a 2 column spreadsheet and use a sort, search or conditional search to find what you want. Plenty of online tutorials for it about. No need to sell your soul to Mr Gates either. Plenty of free spreadsheets as well :-)


Post - Top - Home - Printer Friendly - Translate

Subject: RE: BS: Computer folk: Can this even be done?
From: Nick
Date: 21 Oct 15 - 06:26 PM

Use a spreadsheet and vlookup if I'm understanding.

If you have a text file with the words and numbers and a file of numbers send them to me and its a one minute job


Post - Top - Home - Printer Friendly - Translate

Subject: RE: BS: Computer folk: Can this even be done?
From: Joe_F
Date: 21 Oct 15 - 06:29 PM

In Emacs (the editing language I happen to use), I could do that with a keyboard macro, not even needing to use the extension language Elisp. But I suppose that is neither here nor there.


Post - Top - Home - Printer Friendly - Translate

Subject: RE: BS: Computer folk: Can this even be done?
From: Mr Red
Date: 22 Oct 15 - 05:27 AM

Excel and filters? Finding one or two.
Excel & VBA? Converting a "word" sequence to "number" sequence in external text files. & vice versa.
Excel & "Find"? Finding one or two.

If you can explain the requirement more fully - contact me and we might get a conversation started. If you have Excel that is.


Post - Top - Home - Printer Friendly - Translate

Subject: RE: BS: Computer folk: Can this even be done?
From: McGrath of Harlow
Date: 22 Oct 15 - 09:43 AM

I'm glad I don't need to understand the advice here. It's complete gobbledygook to me.


Post - Top - Home - Printer Friendly - Translate

Subject: RE: BS: Computer folk: Can this even be done?
From: Jack Campin
Date: 22 Oct 15 - 10:17 AM

The way I would do it:

(1) use awk to generate a sequence of lines from the list of codes, like

s/892/tree/

sorting them in reverse order of length of the number (4-digit first, then 3, 2, 1)

(2) put that in a file ("call it "codes", say)

(3) invoke that as a sed script to stream-edit the file.

That way, you have the sed script ready to use again if another file coded the same way comes along.

Works on any kind of Unix and on a lot of systems that borrow ideas from Unix.

Recommended: Kernighan and Pike, The Unix Environment.


Post - Top - Home - Printer Friendly - Translate

Subject: RE: BS: Computer folk: Can this even be done?
From: Bert
Date: 22 Oct 15 - 04:32 PM

Try LEX.


Post - Top - Home - Printer Friendly - Translate

Subject: RE: BS: Computer folk: Can this even be done?
From: GUEST
Date: 23 Oct 15 - 03:48 AM

The problem is that you haven't given is a full description of the exercise.

If you have a list of n words with their numbers and a list of m numbers where m
Table A contains the number list with column name WordNum
Table B contains the full word list with column names WordNum and WordName

Pull out the answer with SQL

Select WordName from "B"
Where A.WordNum = B.WordNum


Post - Top - Home - Printer Friendly - Translate

Subject: RE: BS: Computer folk: Can this even be done?
From: Mr Red
Date: 23 Oct 15 - 04:26 AM

Methinks the OP wants a solution delivered. I doubt he could make much of the stuff I see above. I couldn't in most cases.

But agree it needs more detail.

As I see it he has a list/lookup table and a random request for conversion to the other format. eg numbers to text.

In Excel
VLOOKUP would do it if he has the unknowns in a list or knows how to import them.
VBA would do it if he has the unknowns as a space (eg) delimited file of numbers or words.

Either is trivial to those wot know, and are willing to explain in more detail, eg an XLS file. Get in touch PAL!


Post - Top - Home - Printer Friendly - Translate

Subject: RE: BS: Computer folk: Can this even be done?
From: Bonzo3legs
Date: 23 Oct 15 - 07:24 PM

Use sumproduct in excel


Post - Top - Home - Printer Friendly - Translate

Subject: RE: BS: Computer folk: Can this even be done?
From: GUEST,Mr Red down at the local library
Date: 24 Oct 15 - 08:27 AM

SUMPRODUCT?
I will investigate but sounds unlikely.


Post - Top - Home - Printer Friendly - Translate

Subject: RE: BS: Computer folk: Can this even be done?
From: Jack Campin
Date: 24 Oct 15 - 09:01 AM

Dave the Gnome's suggestion (21 Oct 15 - 05:07 PM) will give a list of decoded words in the order they occur in the file of code/word pairs - if there are 49 occurrences of 892 in the file, there will be 49 repetitions of "tree", all together. I suspect this isn't what's wanted.

My suggestion treats the file of numbers as if it were an encoded document and spits out the decoded words in the same order as their code numbers occur in the number file - if the 71st number in the file is 892, the 71st word in the result will be "tree".

I can't figure out what ordering you'd get with the spreadsheet/database methods suggested here.


Post - Top - Home - Printer Friendly - Translate

Subject: RE: BS: Computer folk: Can this even be done?
From: Dave the Gnome
Date: 24 Oct 15 - 09:16 AM

Damn you Mr Campin - I was hoping to get some consultancy work out of this :-) But seeing as you brought it up - pipe the result to sort -u or uniq. I am not going to give the awk game away so easily though...

:D (tG) or should that be \:D \(tG\)


Post - Top - Home - Printer Friendly - Translate

Subject: RE: BS: Computer folk: Can this even be done?
From: Mr Red
Date: 24 Oct 15 - 11:28 AM

Methinks the OP wants to decode a file full of numbers to be read as a sentence.
As I say, VBA can do it as a complete package. VLOOKUP will also do it with cell formulae if the file contents are imported but that presupposes the file is space delimited and then the GUEST may have to "Text to Columns". Then he has to extract the text to wherever. Excel 2003 only has 256 columns so he would need to transpose to vertical. Which is easily doable with cell formulae.

As for SUMPRODUCT - methinks someone is taking the piss. That is my summation.


Post - Top - Home - Printer Friendly - Translate

Subject: RE: BS: Computer folk: Can this even be done?
From: Mr Red
Date: 24 Oct 15 - 11:33 AM

Is the ultimate aim steganology? Perhaps the OP should try to find apps that service the requirement. There are plenty. Try Portable Apps website for starters.


Post - Top - Home - Printer Friendly - Translate

Subject: RE: BS: Computer folk: Can this even be done?
From: Nick
Date: 25 Oct 15 - 08:42 AM

To summarise, Original Poster, there are plenty of ways to do it and plenty of people willing to offer assistance.

I think that you have a text file that looks a bit like this

Word1    1
Word2    2
Word3    3
...
Word1500   1500

And you have another file which looks like this

1
246
45
34
...
678

And you would like the second file to be transformed into

Word1
Word246
Word45
Word34
...
Word678

If that is it then either post the files somewhere and someone can convert them for you or make contact (you have to be a member and send a Private Message) and someone will help.

The only problem is you don't appear to be around since the original post so I'm guessing you've fixed it? :)


Post - Top - Home - Printer Friendly - Translate

Subject: RE: BS: Computer folk: Can this even be done?
From: DMcG
Date: 25 Oct 15 - 08:50 AM

And if the awk enthusiasts have convinced you but you only have Windows, there are downloads like Babun that add the ability tun most UNIX utilities under Windows.


Post - Top - Home - Printer Friendly - Translate


 


You must be a member to post in non-music threads. Join here.


You must be a member to post in non-music threads. Join here.



Mudcat time: 29 August 11:44 AM EDT

[ Home ]

All original material is copyright © 2022 by the Mudcat Café Music Foundation. All photos, music, images, etc. are copyright © by their rightful owners. Every effort is taken to attribute appropriate copyright to images, content, music, etc. We are not a copyright resource.