Jump to content

[Help] Compiler Words

Featured Replies

Greetings all... i just need guide or opinion from all..

i need to develop the compiler word for short form words to full words..

 

example:

B4U ---> before you

 

so what kind of technique can i implement for this?? it is decision tree??or else?

or what kind of programming language that can i use to develop this??

C#??C++?? or JAVA?

 

hope anybody could give opinion..and help me.

many thanks.

 

 

I'm do not understand what you want. It would help if you had given requirements. One interpretation of your request is that you make a database of two columns. In one column you put short forms (e.g., "B4U"), and in the second column you put the corresponding phrase (e.g., "before you"). If you index both columns, you can find either the short form or long form by knowing either one.

 

If your requirements are different, please explain.

  • Author

Actually i want to know what kind of technique can be used if i want to develop the system that translate the SMS words to full text word...

example just like this...-->http://transl8it.com/

 

it is using only database or what kind of compiler that can be used?? or the technique is just like decision tree??

How many words do you need to translate? A java hashmap can hold simple mappings of data but if you have to store a lot of data you might want a database. It depends on the scope of your task and what you are actually trying to achieve.

A lexical analyzer, such as LEX or FLEX, can be used to generate a parser for both the short and long forms. It is then necessary to replace the strings found by the parser (short/long) with their alternatives (long/short), which is easy enough to code by hand rather than using another tool.

  • Author

How many words do you need to translate? A java hashmap can hold simple mappings of data but if you have to store a lot of data you might want a database. It depends on the scope of your task and what you are actually trying to achieve.

 

ouh.. my scope not to many words..just for the chosen words only... if there have 5 words i only translate for 3 words...

 

 

A lexical analyzer, such as LEX or FLEX, can be used to generate a parser for both the short and long forms. It is then necessary to replace the strings found by the parser (short/long) with their alternatives (long/short), which is easy enough to code by hand rather than using another tool.

 

thanks a lot EdEarl... i learn new things from u... i'll try. ^^

  • Author

one more things i would like to ask...

what is the best technique to develop this compiler??

i have study about LEX and FLEX also java Hashmap...

 

so it's java is more simple or programming c to make the compiler??

I'm not familiar with java Hashmap, but both Java and C are equally complex. Simplicity is more a personal choice; although, sometimes available tools can make a difference. .

one more things i would like to ask...

what is the best technique to develop this compiler??

i have study about LEX and FLEX also java Hashmap...

 

so it's java is more simple or programming c to make the compiler??

If this is quite a small scale thing, I would look at Perl. It has really good built in functions for string handling and pattern-recognition. It can also store data in hash tables; i.e. just like an array but indexed by a string:

$lookup_table{"BTW"} = "by the way";

Because it is an interpreted language it is much simpler to experiment and try things out. The code will not be as fast as writing in C or Java, but that would only matter if your were dealing with very large numbers of words.

  • Author

I'm not familiar with java Hashmap, but both Java and C are equally complex. Simplicity is more a personal choice; although, sometimes available tools can make a difference. .

okies thank's for reply...

 

 

 

If this is quite a small scale thing, I would look at Perl. It has really good built in functions for string handling and pattern-recognition. It can also store data in hash tables; i.e. just like an array but indexed by a string:

$lookup_table{"BTW"} = "by the way";

Because it is an interpreted language it is much simpler to experiment and try things out. The code will not be as fast as writing in C or Java, but that would only matter if your were dealing with very large numbers of words.

 

yup agree. hashmap have the simpler way to interpreted...but if i use for many words there will not be fast to compile. thanks for reply.

Actually i want to know what kind of technique can be used if i want to develop the system that translate the SMS words to full text word...

example just like this...-->http://transl8it.com/

 

it is using only database or what kind of compiler that can be used?? or the technique is just like decision tree??

 

String FromTo(String varString){

 

for(zero ;to amount of abbreviations in Abbreviation array; thisnumber++){

if(varString.equals(Abarray[this number][0]){

varString = Abarray[this number][1];

return varString;

}

}

}

 

Think this would work as a simple pseudo java template, c wouldnt be much more complex, you might have to write a character equivalence function though theres a 99% chance of one existing in the standard libs. :D

 

Decision branching isnt needed as its a direct lookup to an array, though you could use more efficient search algorithms, its not important unless your dealing with large quantities of data.

There are a couple of functions to compare strings in C, including memcmp().

  • Author

 

String FromTo(String varString){

 

for(zero ;to amount of abbreviations in Abbreviation array; thisnumber++){

if(varString.equals(Abarray[this number][0]){

varString = Abarray[this number][1];

return varString;

}

}

}

 

Think this would work as a simple pseudo java template, c wouldnt be much more complex, you might have to write a character equivalence function though theres a 99% chance of one existing in the standard libs. biggrin.png

 

Decision branching isnt needed as its a direct lookup to an array, though you could use more efficient search algorithms, its not important unless your dealing with large quantities of data.

so in opinion there prefer to use java rather than programming c... if java just look up for the array..if use c play with string. okey..i'll try. if my requirement just for the certain words it's better to use java...

for example:

tq 4 ur time ---> thank you for your time.

i just compile the three words from the beginning tq..4...ur.. its is okey to use the array??

yup agree. hashmap have the simpler way to interpreted...but if i use for many words there will not be fast to compile. thanks for reply.

Perl is pretty efficient (it is semi-compiled) and hash tables are efficient by definition. I doubt you would have performance problems unless you have millions of words in your dictionary.

  • Author

Perl is pretty efficient (it is semi-compiled) and hash tables are efficient by definition. I doubt you would have performance problems unless you have millions of words in your dictionary.

so if i have only a hundred of words in my dictionary that would be fine?? coz my scope just for certain words...

so if i have only a hundred of words in my dictionary that would be fine?? coz my scope just for certain words...

Absolutely. I have used Perl to process files containing hundreds of thousands, maybe millions, of lines of data. (It can begin to get a bit slow at that point!)

 

BTW. I'm still not quite sure what you want to do. There are (at least) three things that you might want such a program to do:

 

1. Read a data file containing pairs such as: "BTW=by the way" and so on.

 

This is trivial in Perl. You can read the file in a loop, split each line on the delimiter (=) using the built-in function and then store the meaning ("by the way") in a hash table indexed by the abbreviation.

 

That is a few lines of code.

 

2. Read some text, replace any abbreviations with the expanded meaning, and print out the result.

 

Also very simple. You would have to do a few things like checking if "by the way" should start with a capital letter or not. (Although, based on your posts here, you might not care about that. smile.png)

 

3. Do 2 the other way round; i.e. replacing "by the way" with "BTW"

 

Again, very simple. But you would probably want to store all the data in two hash tables: one to go each way.

  • Author

Absolutely. I have used Perl to process files containing hundreds of thousands, maybe millions, of lines of data. (It can begin to get a bit slow at that point!)

 

BTW. I'm still not quite sure what you want to do. There are (at least) three things that you might want such a program to do:

 

1. Read a data file containing pairs such as: "BTW=by the way" and so on.

 

This is trivial in Perl. You can read the file in a loop, split each line on the delimiter (=) using the built-in function and then store the meaning ("by the way") in a hash table indexed by the abbreviation.

 

That is a few lines of code.

 

2. Read some text, replace any abbreviations with the expanded meaning, and print out the result.

 

Also very simple. You would have to do a few things like checking if "by the way" should start with a capital letter or not. (Although, based on your posts here, you might not care about that. smile.png)

 

3. Do 2 the other way round; i.e. replacing "by the way" with "BTW"

 

Again, very simple. But you would probably want to store all the data in two hash tables: one to go each way.

the program that i want to develop similar with no 2... read the input text then replace the abbreviations with the meaning and the result will print out the meaning...

if the program should start with checking by capital its work if i'm doing via indexed??

the program that i want to develop similar with no 2... read the input text then replace the abbreviations with the meaning and the result will print out the meaning...

if the program should start with checking by capital its work if i'm doing via indexed??

 

The thing is, the output might need to be adjusted depending on context.

 

For example:

"Saw the new car BTW" => "Saw the new car by the way"

But:

"BTW saw the new car" => "By the way saw the new car"

 

So you might need to see if the phrase comes at the start of a line or after a full stop to decide whether to capitalise it or not.

 

Or, just convert everything to lower case, as you seem happy with that. :)

  • Author

 

The thing is, the output might need to be adjusted depending on context.

 

For example:

"Saw the new car BTW" => "Saw the new car by the way"

But:

"BTW saw the new car" => "By the way saw the new car"

 

So you might need to see if the phrase comes at the start of a line or after a full stop to decide whether to capitalise it or not.

 

Or, just convert everything to lower case, as you seem happy with that. smile.png

ohhh...yeah..now i understand.. thank's a lot for help.. u explanation help me a lot.. ^^ really appreciate... smile.png

  • 3 weeks later...
  • Author

sorry again.

may i know for develop this compiler system...which one is the best software to build this?? its is okey if im using NetBeans?? or i should use Eclipse??

actually i need guide to develop this..because im starting from nothing to knowing step by step..

 

NetBeans and Eclipse are IDEs, like Visual Studio, DevC++, Emacs, Vim, NView, Geany or Sublime, any text editor with syntax highlighting will help you write your code with fewer errors. And you can build this in almost any language (some more difficult than others), this would be more trivial in scripting language

  • Author

ouh...which one the more suitable for my system translation??

because some of the software quite difficult to manage it.

sorry again.

may i know for develop this compiler system...which one is the best software to build this?? its is okey if im using NetBeans?? or i should use Eclipse??

 

Whichever you are most comfortable with. (persoanlly, I find NetBeans slightly easier to use than Eclipse. Others disagree.

 

 

actually i need guide to develop this..because im starting from nothing to knowing step by step..

 

This is an interesting example to learn programming with. I would suggest you pick a language (Perl, Java, C#, Python, whatever) then buy a book (or find an online resource) that teaches programming with that language and use your idea as a learning project. Then come back here with questions when you get stuck.

 

I don't know if anyone here has the time to teach you programming via this forum (I don't).

  • Author

 

Whichever you are most comfortable with. (persoanlly, I find NetBeans slightly easier to use than Eclipse. Others disagree.

 

 

This is an interesting example to learn programming with. I would suggest you pick a language (Perl, Java, C#, Python, whatever) then buy a book (or find an online resource) that teaches programming with that language and use your idea as a learning project. Then come back here with questions when you get stuck.

 

I don't know if anyone here has the time to teach you programming via this forum (I don't).

yeah...i understand.. most comfortable is java.. i try to do it first...thanks for your respond...^^

ouh...which one the more suitable for my system translation??

because some of the software quite difficult to manage it.

It doesnt matter for the IDE, whatever you are most comfortable with, if none, i suggest you check out sublime (for mostly everything) or eclipse (for java).

 

As far as languages go, any language works, pick one, and go with it, except Perl and Tcl, for the love of everything beautiful in computing, leave the old languages alone. Python, PHP, Ruby, JavaScript (biggest advantage here is that you can run your code entirely in your browser), C++, C#, Java, they all work for the purpose. You can also go to places like Udacity and Coursera, sign up for a course on programming (language-dependent or independent), and start there with learning the basics and applying them to your project...

Edited by AtomicMaster

Archived

This topic is now archived and is closed to further replies.

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.