AandP: Utilizing Prolog for converting between active sentence and passive sentence with three-steps conversion

01/16/2020
by   Trung Q. Tran, et al.
0

I introduce a simple but efficient method to solve one of the critical aspects of English grammar which is the relationship between active sentence and passive sentence. In fact, an active sentence and its corresponding passive sentence express the same meaning, but their structure is different. I utilized Prolog [4] along with Definite Clause Grammars (DCG) [5] for doing the conversion between active sentence and passive sentence. Some advanced techniques were also used such as Extra Arguments, Extra Goals, Lexicon, etc. I tried to solve a variety of cases of active and passive sentences such as 12 English tenses, modal verbs, negative form, etc. More details and my contributions will be presented in the following sections. The source code is available at https://github.com/tqtrunghnvn/ActiveAndPassive.

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 1

page 7

01/27/2021

Neural Sentence Ordering Based on Constraint Graphs

Sentence ordering aims at arranging a list of sentences in the correct o...
05/14/2021

ATHENA: Advanced Techniques for High Dimensional Parameter Spaces to Enhance Numerical Analysis

ATHENA is an open source Python package for reduction in parameter space...
12/19/2017

Passive ans Active Observation: Experimetal Design Issues in Big Data

Data can be collected in scientific studies via a controlled experiment ...
12/19/2017

Passive ans Active Observation: Experimental Design Issues in Big Data

Data can be collected in scientific studies via a controlled experiment ...
12/19/2017

Passive and Active Observation: Experimental Design Issues in Big Data

Data can be collected in scientific studies via a controlled experiment ...
10/26/2018

Integrating Transformer and Paraphrase Rules for Sentence Simplification

Sentence simplification aims to reduce the complexity of a sentence whil...
02/14/2021

Reflecting stochastic dynamics of active-passive crowds in a queueing theory model

Stochastic differential equation (SDE) models have been extensively used...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Figure 1: A variety of stuff in English grammar

Language plays a vital role in the human life. A language is a structured system of communication [1]

. There are various language systems in the world with the estimated number being between 5,000 and 7,000

[8]

. Natural Language Processing (NLP) which we commonly hear is a subfield of linguistics. NLP aims to provide interactions between computers and human languages. The performance of NLP is evaluated by how computers can process and analyze large amounts of natural language data

[7]. In terms of language processing, we cannot but mention Computational Linguistics [2]. Computational Linguistics is the scientific study of language from a computational perspective, and thus an interdisciplinary field, involving linguistics, computer science, mathematics, logic, cognitive science, and cognitive psychology.

One of the most useful tools for studying computational linguistics is Prolog programming language [4]

. Prolog is a logic programming language associated with artificial intelligence and computational linguistics. Prolog can help deal with issues related to not only logic puzzle (Cryptoarithmetic puzzles, Zebra Puzzle, etc.) but also natural language processing. In this work, I utilized Prolog along with Definite Clause Grammars (DCG)

[5] to solve one of the critical aspects of English grammar, active sentence and passive sentence. DCG proves the efficiency in handling the grammar of the sentence. Basically, a sentence is built out of noun phrase and verb phrase, so the structure of sentence, noun phrase, and verb phrase will be both covered in this work.

In terms of English grammar, we have lots of content to solve as shown in Figure 1. For example, there are 12 tenses in English such as the simple past tense, the simple present tense, the perfect present tense, etc. We also have more than three types of conditional clause, more than three types of comparative clause, and so on. This work covers the contents of active sentence and passive sentence. For instance, if an active sentence is “a man buys an apple in the supermarket”, its corresponding passive sentence will be “an apple is bought by a man in the supermarket”. The basic rules for rewriting an active sentence to passive sentence are shown clearly in Figure 2.

(a) The basic example
(b) The example of modal verb
Figure 2: Basic rules for converting an active sentence to passive sentence

As shown in Figure 2, basic rules are:

  • The object of the active sentence becomes the subject of the passive sentence;

  • The subject of the active sentence becomes the object of the passive sentence;

  • The finite form of the verb is changed to “to be + past participle”.

As my best understanding so far, there are only a few works mentioning the problem of active sentence and passive sentence in terms of language processing and computational linguistics. The conversion between active sentence and passive sentence was early mentioned in [6] by using a transformation rule to express the relationship between active and passive sentences. According to this rule, a parse tree is produced to represent the deep structure and determine whether the given sentence is active or passive. Similarly, [3] also used a tree-to-tree mapping to represent the active/passive transformation rule. However, these works just stopped in introducing how to transform an active sentence to passive sentence and did not solve many cases of them. Actually, there are many cases of active and passive sentences, leading to extra rules for converting between them. It is not easy to handle all these cases, and this is the main challenge of this work. My contributions are shown as follows:

  1. As far as I know, this may be the first work utilizing Prolog and DCG to solve a variety of cases of converting between active sentence and passive sentence such as 12 English tenses, modal verbs, negative form, etc.

  2. I proposed a compact version of the representation of the sentence as shown in Figure 3 and Figure 4.

  3. In order to deal with 12 tenses in English, I proposed an auxiliary-based solution (is presented in Section 3.2) for dividing 12 tenses into 4 groups. This is a very nice solution that reduces the workload of defining DCG rules.

  4. I also proposed a three-steps conversion (is presented in Section 3.3) for doing the conversion between active sentence and passive sentence.

2 Analysis and Discussion

2.1 Cases to be solved

The main challenge of this work is how much it can handle cases. There are a variety of cases in terms of active sentence and passive sentence. The cases that I solved in this work are shown as follows.

  1. The possibility of the conversion: the prerequisite to convert an active sentence to a passive sentence is that the active sentence must have the object. For instance:

    • The sentence “the man buys an apple” is converted to the passive form being “an apple is bought by the man”;

    • However, the sentence “the man goes to school” cannot be converted to the passive form because of the lack of object.

  2. The tenses of the sentence: there are 12 tenses in English such as simple present tense, continuous past tense, perfect present tense, perfect continuous future tense, etc. With each tense, there is a specific way for converting between active sentence and passive sentence. For example (from active form to passive form):

    • In the simple present tense: “the man buys an apple” is converted to “an apple is bought by the man”;

    • In the perfect present tense: “the man has bought an apple” is converted to “an apple has been bought by the man”.

    This work handles all these 12 tenses.

  3. The form of past participle: commonly, a verb is converted to past participle form by adding “ed” at the end (example: “add” becomes “added”, “look” becomes “looked”). However, there are some exceptions such as “buy” becomes “bought”, “see” becomes “seen”, etc.

  4. The case of negative sentence. For example, the negative form of “the man buys an apple” is “the man does not buy an apple”, and the corresponding passive sentence is “an apple is not bought by the man”.

  5. The case of modal verb: modal verbs (also called modals, modal auxiliary verbs, modal auxiliaries) are special verbs which behave irregularly in English. They are different from normal verbs like “work”, “play”, “visit”, etc. Modal verbs are always followed by an infinitive without “to”. For example, the sentence “the boy should bring a pen to the class” is converted to the passive form being “a pen should be brought by the boy to the class” (Figure 1(b)).

  6. Moreover, this work also handles the cases of singular/plural, subject pronoun/object pronoun, etc. For instance, the pronoun “he” is used for the subject as “he” but is used for the object as “him”.

2.2 Representation and Inference

The objective of this work is sentences: active sentence and passive sentence, so I need to determine the representation of both active sentence and passive sentence.

  1. An active sentence is built out of a noun phrase and a verb phrase. Therefore basically, the representation of an active sentence is s(NP,VP). The noun phrase or verb phrase is built out of fundamental elements such as determiner, noun, adjective, verb, etc. Simply, the representation of fundamental elements are shown as follows:

    • Determiner: det(X). Example: det(a), det(an), det(the), etc.

    • Noun: n(X). Example: n(man), n(woman), n(apple), etc.

    • Pronoun: pro(X). Example: pro(he), pro(she), pro(him), etc.

    • Adjective: adj(X). Example: adj(small), adj(big), adj(beautiful), etc.

    • Verb: v(X). Example: v(play), v(like), v(love), etc.

    • Preposition: pre(X). Example: pre(on), pre(in), pre(by), etc.

    • Auxiliary verb: aux(X). Example: aux(do), aux(does), aux(is), aux(be), etc. Actually, there are three types of auxiliary verbs are used in this work. For example, the sentence “you will have been loving them” (perfect continuous future tense) has three auxiliary verbs are “will”, “have”, “been” which are determined by three predicates aux/5, aux1/4, aux2/4 as shown in the source code (convertible.pl), respectively.

    • Auxiliary verb for tense in the passive form: auxTense(X). There are three groups of auxTense:

      • Group 1: including only simple future tense: auxTense(be). Example: “an apple will be bought buy the man”.

      • Group 2: consisting of continuous past tense, continuous present tense, continuous future tense, perfect continuous past tense, perfect continuous present tense, and perfect continuous future tense: auxTense(being). Example: “an apple was being bought by a man”, “an apple will be being bought by him”.

      • Group 3: including perfect past tense, perfect present tense, and perfect future tense: auxTense(been). Example: “an apple has been bought by the man”, “an apple will have been bought by the man”.

    • Modal verb: modal(X). Example: modal(should), modal(can), modal(may), etc.

    • Moreover, this work also uses pol(not) for the negative form and agent(by) for the passive form.

  2. With a noun phrase, there are some ways to build the noun phrase such as:

    • A noun phrase is built out of a determiner and a noun, so its representation is np(DET,N). Example: noun phrase “the man” has the representation is np(det(the),n(man)).

    • A noun phrase is built out of pronoun such as “he”, “she”, “we”, etc. In this case, the representation of the noun phrase is simply np(PRO). For example: np(pro(he)).

    • A noun phrase is built out of a determiner, adjectives, and a noun. In this case, the representation of the noun phrase is np(DET,ADJ,N). For example, the noun phrase “a small beautiful girl” has the representation is np(det(a),adi([small, beautiful]), n(girl)).

    • A noun phrase is built out of a noun phrase and a prepositional phrase. The representation of the noun phrase in this case is np(DET,N,PP), np(PRO,PP), or np(DET,ADJ,N,PP). For example, the noun phrase “a cat on the big table” has the representation is

      np(det(a),n(cat),pp(pre(on),det(the),adj([big]),n(table))).

  3. With a verb phrase, there are two ways to build the verb phrase:

    • A verb phrase is built out of a verb and a noun phrase. In this case, the presentation of the verb phrase is vp(V,NP). For example, the verb phrase “love a beautiful woman” has the representation is vp(v(love), np(det(a), adj([beautiful]), n(woman))).

    • A verb phrase is built out of only a verb, so its representation is simply vp(V). Example: vp(v(love)) or vp(v(eat)). In fact, as presented above, in order to be able to convert from an active sentence to a passive sentence, the active sentence has to have the object. Therefore, the case of verb phrase vp(V) will not be considered in this work.

  4. After having the representation of noun phrase and verb phrase, the representation of the sentence could be obtained.

    • Originally, the active sentence “he buys an apple” has the representation is

      s(np(pro(he)),vp(v(buys),np(det(an),n(apple)))).

      However, as presented above, this work only considers the case of verb phrase vp(V,NP), so I proposed a compact version of the representation of the sentence as shown in Figure 3.

      Figure 3: The compact version of the representation of the active sentence

      Therefore, the active sentence “he buys an apple” has the representation is

      s(np(pro(he)), v(buys), np(det(an), n(apple))).

    • The passive sentence “an apple is bought by him” has the representation is

      s(np(det(an), n(apple)), aux(is), v(bought), agent(by), np(pro(
      him)))
      .

As introduced in the DCG [5], the representation of the sentence is represented by “parse tree” as illustrated in Figure 3 (active sentence) and Figure 4 (passive sentence). Parse tree could be found with the help of advanced techniques like extra arguments and extra goals.

Figure 4: The representation of the passive sentence

“Inference” is the conversion between a sentence and its representation, or even the conversion between an active sentence and a passive sentence:

  • Given a sentence, “inference” is the process of getting the representation of that sentence;

  • Given a representation of a sentence, “inference” is the process of getting that sentence.

The final purpose of this work is that:

  • Given an active sentence, we will get the respective passive sentence; and vice versa,

  • Given a passive sentence, we will get the respective active sentence.

3 Design and Implementation

3.1 Scenario for user interaction

User interacts with the program by posing the query with the form (Figure 5):

convert(ActiveS, ActiveRe, PassiveS, PassiveRe).

Figure 5: The scenario for user interaction

Where:

  • ActiveS: the active sentence represented by a list where each element of the list corresponds to each word of the sentence. Example: [he,buys,an,apple].

  • ActiveRe: the representation of the active sentence ActiveS.

    Example: s(np(pro(he)),v(buys),np(det(an),n(apple))).

  • PassiveS: the passive sentence represented by a list where each element of the list corresponds to each word of the sentence. Example: [an,apple,is,bought,by,him].

  • PassiveRe: the representation of the passive sentence PassiveS. Example:

    s(np(det(an),n(apple)),aux(is),v(bought),agent(by),np(pro(him))).

Input will be either ActiveS or PassiveS for the case of converting from an active sentence to a passive sentence and the case of converting from a passive sentence to an active sentence, respectively.

There are several cases of output:

  • If the input is ActiveS and it is able to convert to the passive sentence, the outputs will be ActiveRe, PassiveS, and PassiveRe.

  • If the input is PassiveS and it is able to convert to the active sentence, the outputs will be ActiveS, ActiveRe, and PassiveRe.

  • If the input is either ActiveS or PassiveS but it is not able to convert to passive/active sentence, the output will be ‘false’. There are some cases which cannot be converted:

    • ActiveS is the active sentence but is typed as a passive sentence;

    • PassiveS is the passive sentence but is typed as an active sentence;

    • ActiveS is an active sentence having no object. Example: the sentence “he goes” cannot be converted to the passive sentence.

Especially, we can pose the query with no input, and the program will generate all possible cases of the active sentence and passive sentence. Some examples to make user interaction more clear will be presented in Section 4.

3.2 Auxiliary-based solution to handle 12 English tenses

There are 12 tenses in English. Each tense has a specific structure for the sentence. If each tense is handled individually, it will be quite long and be not an optimal solution. Therefore, as my best observation, I found a solution which divides 12 English tenses into 4 groups (same color means same group) based on the number of auxiliary verbs in the active sentence. This solution is summarized in Figure 6, consisting of:

  • Group 1: the number of auxiliary verbs in the active sentence is equal to 0. This group consists of the simple past tense and the simple present tense;

  • Group 2: the number of auxiliary verbs in the active sentence is equal to 1. We have 5 tenses in this group, those are the simple future tense, the continuous past tense, the continuous present tense, the perfect past tense, and the perfect present tense;

  • Group 3: the number of auxiliary verbs in the active sentence is equal to 2. This group consists of the continuous future tense, the perfect future tense, the perfect continuous past tense, and the perfect continuous present tense;

  • Group 4: the number of auxiliary verbs in the active sentence is equal to 3. This group has only one tense which is the perfect continuous future tense.

Figure 6: Auxiliary-based solution: the division of 12 tenses into 4 groups

As we can easily see in Figure 6, tenses in the same group has the same structure of representation. For example, DCG rules for active sentence and passive sentence of group 3 are implemented as follows.

/*================== Group 3: For continuous_future, perfect_future, ==================*/
/*=============== perfect_continuous_past, and perfect_continuous_present ===============*/
/*============================ Positive - Active sentence =============================*/
s(s(NP1,AUX,AUX1,V,NP2),Tense,Qs,Qo) -->
                        np(NP1,subject,Qs),
                        (
                                {\+ NP1=np(pro(i))},
                                aux(AUX,Tense,Qs)
                        ;
                                {NP1=np(pro(i))},
                                aux(AUX,Tense,special)
                        ),
                        aux1(AUX1,Tense),
                        v(V,Tense,Qs,group3),
                        np(NP2,object,Qo).
/*============================ Positive - Passive sentence =============================*/
s1(s(NP2,AUX,AUX1,AUX_TENSE,V,agent(by),NP1),Tense,Qs,Qo) -->
                        np(NP2,subject,Qs),
                        (
                                {\+ NP2=np(pro(i))},
                                aux(AUX,Tense,Qs)
                        ;
                                {NP2=np(pro(i))},
                                aux(AUX,Tense,special)
                        ),
                        aux1(AUX1,Tense),
                        aux(AUX_TENSE,Tense),
                        v(V,past_participle,Qs,past_participle),
                        agent,
                        np(NP1,object,Qo).

3.3 Three-steps conversion

The three-steps conversion consists of three steps:

  1. From the input sentence fed as a list, the program first finds the representation of the sentence.

  2. From the representation of active or passive sentence, the program then finds the representation of passive or active sentence, respectively.

  3. From the representation achieved in the step, the program returns the converted sentence as a list.

The implementation of the three-steps conversion (written in convert.pl) is shown as follows.

/*=============================== Three-steps conversion ===============================*/
convert(ActiveS,ActiveRe,PassiveS,PassiveRe) :-
        /*=== From Active sentence to Passive sentence ===*/
        (\+ var(ActiveS);\+ var(ActiveRe)),
        s(ActiveRe,Tense,Qs,Qo,ActiveS,[]),             % First step
        write(’Tense: ’),write(Tense),write(’\n’),
        convert(ActiveRe,Tense,Qs,Qo,PassiveRe),        % Second step
        !,
        s1(PassiveRe,Tense,Qo,Qs,PassiveS,[])           % Third step
;
        /*=== From Passive sentence to Active sentence ===*/
        (\+ var(PassiveS);\+ var(PassiveRe)),
        s1(PassiveRe,Tense,Qo,Qs,PassiveS,[]),          % First step
        write(’Tense: ’),write(Tense),write(’\n’),
        convert(ActiveRe,Tense,Qs,Qo,PassiveRe),        % Second step
        !,
        s(ActiveRe,Tense,Qs,Qo,ActiveS,[])              % Third step
;
        /*=========== Generate all cases =================*/
        var(ActiveS),var(ActiveRe),var(PassiveS),var(PassiveRe),
        s(ActiveRe,Tense,Qs,Qo,ActiveS,[]),             % First step
        write(’Tense: ’),write(Tense),write(’\n’),
        convert(ActiveRe,Tense,Qs,Qo,PassiveRe),        % Second step
        s1(PassiveRe,Tense,Qo,Qs,PassiveS,[]).          % Third step

The and steps are done by using DCG rules (implemented in convertible.pl). The step is easily done by the rule like:

/*==================== Group 1: For simple_present and simple_past =====================*/
/*================================== Positive sentence =================================*/
convert(s(NP1,v(Y),NP2),Tense,Qs,Qo,s(NP22,aux(Aux),v(Y1),agent(by),NP11)) :-
        subAndObj(NP1,NP11),
        subAndObj(NP22,NP2),
        (
                \+ NP22=np(pro(i)),
                lex(Aux,aux,Tense,Qo)
        ;
                NP22=np(pro(i)),
                lex(Aux,aux,Tense,special)
        ),
        past_participle(Y,Y1,Qs,Tense).

As you can see above, the step is easily done by doing the conversion between corresponding elements. More details for other groups are shown in convert.pl.

3.4 Others

All implementations above are for the positive form of the sentence. The negative form of the sentence can be easily done by inheriting the rules that are defined for the positive form. DCG rule for the negative form is implemented as follows.

/*===================================== DCG rules ======================================*/
/*========== Group 2: For simple_future, continuous_past, continuous_present, ==========*/
/*======================== perfect_past, and perfect_present ============================*/
/*================================== Positive sentence =================================*/
s(s(NP1,AUX,V,NP2),Tense,Qs,Qo) -->
                        np(NP1,subject,Qs),
                        (
                                {\+ NP1=np(pro(i))},
                                aux(AUX,Tense,Qs)
                        ;
                                {NP1=np(pro(i))},
                                aux(AUX,Tense,special)
                        ),
                        v(V,Tense,Qs,group2),
                        np(NP2,object,Qo).
/*================================== Negative sentence =================================*/
s(s(NP1,AUX,pol(not),V,NP2),Tense,Qs,Qo) -->
                        np(NP1,subject,Qs),
                        (
                                {\+ NP1=np(pro(i))},
                                aux(AUX,Tense,Qs)
                        ;
                                {NP1=np(pro(i))},
                                aux(AUX,Tense,special)
                        ),
                        pol,
                        v(V,Tense,Qs,group2),
                        np(NP2,object,Qo).

DCG rules for the negative form is almost similar to those of the positive form, except from pol/1 predicate. However, in the step for the negative form, it completely utilizes the rule for the positive form as follows.

/*===================================== step =======================================*/
/*========== Group 2: For simple_future, continuous_past, continuous_present, ==========*/
/*======================== perfect_past, and perfect_present ============================*/
/*================================== Positive sentence =================================*/
convert(s(NP1,aux(Aux1),v(Y),NP2),Tense,Qs,Qo,s(NP22,aux(Aux),auxTense(AuxTense),v(Y1),agent(by),NP11)) :-
        subAndObj(NP1,NP11),
        (
                \+ NP1=np(pro(i)),
                lex(Aux1,aux,Tense,Qs)
        ;
                NP1=np(pro(i)),
                lex(Aux1,aux,Tense,special)
        ),
        subAndObj(NP22,NP2),
        (
                \+ NP22=np(pro(i)),
                lex(Aux,aux,Tense,Qo)
        ;
                NP22=np(pro(i)),
                lex(Aux,aux,Tense,special)
        ),
        lex(AuxTense,aux,Tense),
        past_participle(Y,Y1,Qs,Tense).
/*================================== Negative sentence =================================*/
convert(s(NP1,aux(Aux1),pol(not),v(Y),NP2),Tense,Qs,Qo,s(NP22,aux(Aux),pol(not),auxTense(AuxTense),v(Y1),agent(by),NP11)) :-
        convert(s(NP1,aux(Aux1),v(Y),NP2),Tense,Qs,Qo,s(NP22,aux(Aux),auxTense(AuxTense),v(Y1),agent(by),NP11)).

However, there is an exception of the step for group 1, it needs an extra rule like:

/*===================== Group 1: For simple_present and simple_past ====================*/
/*================================== Positive sentence =================================*/
convert(s(NP1,v(Y),NP2),Tense,Qs,Qo,s(NP22,aux(Aux),v(Y1),agent(by),NP11)) :-
        subAndObj(NP1,NP11),
        subAndObj(NP22,NP2),
        (
                \+ NP22=np(pro(i)),
                lex(Aux,aux,Tense,Qo)
        ;
                NP22=np(pro(i)),
                lex(Aux,aux,Tense,special)
        ),
        past_participle(Y,Y1,Qs,Tense).
/*================================== Negative sentence =================================*/
convert(s(NP1,aux(AUX_POL),pol(not),v(Y),NP2),Tense,Qs,Qo,s(NP22,aux(Aux),pol(not),v(Y1),agent(by),NP11)) :-
        subAndObj(NP1,NP11),
        lex(AUX_POL,pol,Tense,Qs),
        subAndObj(NP22,NP2),
        (
                \+ NP22=np(pro(i)),
                lex(Aux,aux,Tense,Qo)
        ;
                NP22=np(pro(i)),
                lex(Aux,aux,Tense,special)
        ),
        past_participle(Y,Y1,plural,simple_present).

As we can see above, the negative form of group 1 needs the extra rule lex(AUX_POL,pol,Tense
,Qs)
because, in this negative form, an extra auxiliary verb is needed. For example, the positive sentence is “he buys an apple”, but the corresponding negative sentence is “he does not buy an apple”. Other implementations such as lexicon, modal verbs, etc. are carefully written in the source code.

4 Results

This work has been already done with three files:

  • convertible.pl: implementing DCG rules for and steps in the three-steps conversion, as well as other rules including lexicon.

  • convert.pl: implementing the three-steps conversion and its step.

  • testSuite.pl: providing commands for user interaction. Users do not need to type the input sentence as a list (like [the, man, buys, an, apple]) but can type the sentence in the common way (directly type: the man buys an apple) by using two commands: active and passive. Moreover, users can easily check the correctness of the program by using two test suite commands: activeTestSuite and passiveTestSuite.

Some execution examples are shown as follows.

?- active.
> a beautiful woman has bought a small apple on the big beautiful table.
ActiveS: [a,beautiful,woman,has,bought,a,small,apple,on,the,big,beautiful,table]
Tense: perfect_present
ActiveRe: s(np(det(a),adj([beautiful]),n(woman)),aux(has),v(bought),np(det(a),adj([small]),n(apple),pp(pre(on),np(det(the),adj([big,beautiful]),n(table)))))
PassiveS: [a,small,apple,on,the,big,beautiful,table,has,been,bought,by,a,beautiful,woman]
PassiveRe: s(np(det(a),adj([small]),n(apple),pp(pre(on),np(det(the),adj([big,beautiful]),n(table)))),aux(has),auxTense(been),v(bought),agent(by),np(det(a),adj([beautiful]),n(woman)))
true ;
false.
?- passive.
> a small apple should not be bought by him.
PassiveS: [a,small,apple,should,not,be,bought,by,him]
Tense: simple_present
ActiveS: [he,should,not,buy,a,small,apple]
ActiveRe: s(np(pro(he)),modal(should),pol(not),v(buy),np(det(a),adj([small]),n(apple)))
PassiveRe: s(np(det(a),adj([small]),n(apple)),modal(should),pol(not),aux(be),v(bought),agent(by),np(pro(him)))
true ;
false.

It should be noted that if users use active or passive commands, everything they type has to be defined in the lexicon or users have to define them in the lexicon (implemented in convertible.pl).

5 Conclusion

I introduced an effort to solve the problem of active and passive sentences using Prolog in terms of computation linguistics. By observing the possibility of converting an active sentence to passive sentence, I proposed a compact version of the representation of the sentence (Figure 3 and Figure 4). I also introduced a solution called auxiliary-based solution (Section 3.2) to deal with 12 tenses in English. The auxiliary-based solution helps to reduce the workload of defining DCG rules. Finally, I proposed the three-steps conversion (Section 3.3) for converting between active sentence and passive sentence. In the future, this work should consider solving other cases of active and passive sentences as much as possible.

References

  • [1] D. Davidson and G. Harman (2012) Semantics of natural language. Vol. 40, Springer Science & Business Media. Cited by: §1.
  • [2] R. Grishman (1986) Computational linguistics: an introduction. Cambridge University Press. Cited by: §1.
  • [3] P. M. Nugues (2006) An introduction to language processing with perl and prolog. Springer. Cited by: §1.
  • [4] F. C. Pereira and S. M. Shieber (2002) Prolog and natural-language analysis. Microtome Publishing. Cited by: AandP: Utilizing Prolog for converting between active sentence and passive sentence with three-steps conversion, §1.
  • [5] F. C. Pereira and D. H. Warren (1980) Definite clause grammars for language analysis—a survey of the formalism and a comparison with augmented transition networks. Artificial intelligence 13 (3), pp. 231–278. Cited by: AandP: Utilizing Prolog for converting between active sentence and passive sentence with three-steps conversion, §1, §2.2.
  • [6] J. Stobo (2004) Problem solving with prolog. CRC Press. Cited by: §1.
  • [7] Wikipedia Language. Note: https://en.wikipedia.org/wiki/Language Cited by: §1.
  • [8] Wikipedia Natural language processing. Note: https://en.wikipedia.org/wiki/Natural_language_processing Cited by: §1.