Software to transform sentences

  • Thread starter Thread starter robertjford80
  • Start date Start date
  • Tags Tags
    Software Transform
Click For Summary
SUMMARY

This discussion focuses on developing software to transform formal language expressions using specific algorithms. The example provided illustrates the transformation of the expression "(x'Hy) BC (x'Hz)" into "((w'Hp) IDx'-z) A ((w'Hp) IDx'-y)". Key steps in the algorithm include identifying subjects and objects, replacing symbols, and inserting identifiers. The user mentions using Perl for string manipulation in the past, while also noting C++ as a more elegant alternative for similar tasks.

PREREQUISITES
  • Understanding of formal language syntax and semantics
  • Familiarity with algorithm design and implementation
  • Proficiency in Perl and C++ programming languages
  • Knowledge of string manipulation techniques
NEXT STEPS
  • Research algorithms for formal language transformation
  • Explore Perl string manipulation functions and libraries
  • Learn about C++ string handling and manipulation techniques
  • Study the principles of syntax trees in formal languages
USEFUL FOR

Software developers, particularly those interested in formal language processing, algorithm design, and string manipulation techniques in programming languages like Perl and C++.

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

  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 13 ·
Replies
13
Views
2K
Replies
4
Views
2K