Software to transform sentences

  • Thread starter Thread starter robertjford80
  • Start date Start date
  • Tags Tags
    Software Transform
AI Thread Summary
The discussion centers on developing software to transform formal languages by converting symbols according to specific algorithms. The user provides an example transformation, illustrating how to change expressions involving subjects and objects represented by variables. Key points include the need for an algorithm that identifies subjects and objects based on their positions relative to capital letters, and the process of replacing symbols and inserting new elements in a structured manner. The user mentions previous experience with Perl for string manipulation, noting its ease of use compared to C++, which they find more elegant. The focus is on creating a systematic approach to language transformation that adheres to defined rules.
robertjford80
Messages
388
Reaction score
0
I want to build some software that will transform a formal language from one set of symbols to another. What would be the best software to do that with. Here is one example of what I want to do:

Say we have

(x'Hy) BC (x'Hz)

I need an algorithm to transform that into:

((w'Hp) IDx'-z) A ((w'Hp) IDx'-y)

What that means is: x becomes y means something identifies x with z after something identifies x with y. where x' y z w' and p are variables - the apostrophe mark is a part of the variable.

Here's how I explain the algorithm:

That which comes before a capital letter is the subject and that which comes after is the object, so in xHy, x is the subject and y is the object. In (xHy) CA (zHw) x is the object of H which is the subject of CA and z is the subject of H which is the object of CA.

Change BC to A
replace the subject of BC with its object and replace its object with its subject, in other words:
(xHy) BC (zHw) would become
(zHw) BC (xHy)
replace H with -
place an ID before the old subject of H, in other words:
xHy would become IDx-y
insert a subject before the ID on both sides of the A and the subject must be the same on both sides of the A. The subject must an H and the subject and object can be any variable so long as it is not used. And it also must come between the left parenthesis and the ID
 
Physics news on Phys.org
I remember I used Perl when I wanted to play around with strings a few years ago. C++ is more elegant, but back then I found Perl's handling of strings easier to work with (for the purposes of what I was trying to do, at any rate, which was comparing two strings and pointing out the differences and calculating the degree of similarity).

Sorry I can't be more helpful.
 

Similar threads

Back
Top