Next Article in Journal
Effect of Pitch Parameters on Aerodynamic Forces of a Straight-Bladed Vertical Axis Wind Turbine with Inclined Pitch Axes
Next Article in Special Issue
A Study of Multilayer Perceptron Networks Applied to Classification of Ceramic Insulators Using Ultrasound
Previous Article in Journal
Investigation of Regenerative Braking Performance of Brushless Direct Current Machine Drive System
Previous Article in Special Issue
Interferometric Wavefront Sensing System Based on Deep Learning
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Split-Based Algorithm for Weighted Context-Free Grammar Induction

1
Department of Field Theory, Electronic Circuits and Optoelectronics, Wroclaw University of Science and Technology, 50-370 Wroclaw, Poland
2
Department of Computer Science and Automatics, University of Bielsko-Biala, 43-309 Bielsko-Biala, Poland
3
Department of Computer Engineering, Wroclaw University of Science and Technology, 50-370 Wroclaw, Poland
*
Author to whom correspondence should be addressed.
Appl. Sci. 2021, 11(3), 1030; https://doi.org/10.3390/app11031030
Submission received: 16 November 2020 / Revised: 18 January 2021 / Accepted: 20 January 2021 / Published: 24 January 2021
(This article belongs to the Special Issue Applied Artificial Intelligence (AI))

Abstract

:
The split-based method in a weighted context-free grammar (WCFG) induction was formalised and verified on a comprehensive set of context-free languages. WCFG is learned using a novel grammatical inference method. The proposed method learns WCFG from both positive and negative samples, whereas the weights of rules are estimated using a novel Inside–Outside Contrastive Estimation algorithm. The results showed that our approach outperforms in terms of F1 scores of other state-of-the-art methods.

1. Introduction

The task of grammar or automata induction is a part of symbolic artificial intelligence [1] and is called grammatical inference or grammar induction [2]. Among different subtasks of this scientific field, learning (stochastic or more general weighted) context-free grammars (CFGs) from input data has been growing in importance, due to its practical implications such as natural language and biological sequences modelling.
Learning CFG is known to be a hard task and notable open questions are still open [2]. According to Gold’s theorem [3], CFGs cannot be learned from positive examples only, but in 1969 Horning proved that for effective probabilistic/stochastic CFG (PCFG) induction no negative evidence is obligatory [4]. It is imperative to note that learning PCFG only from positive data leads to grammars, thereby making it difficult to discriminate negative sequences from the input data. To overcome these difficulties, we have recently proposed the novel algorithm for weighted CFG (WCFG) learning [5,6]. Weighted Grammar-based Classifier System (WGCS) is one of the few grammatical inference approaches learning both grammar structure (i.e., rules) and stochastic grammar parameters (i.e., weights of rules). Initially, the method was dedicated to learning crisp context-free grammar [7], and later, it was extended to weighted versions (including fuzzy one [8] or stochastic [9]).
WGCS is learned in an unsupervised manner from unannotated data such as, a structured corpus or treebank. There are some other unsupervised grammatical inference methods like ABL [10], EMILE [11], ADIOS [12], or LS [13]. However, none of these methods induces both structure and parameters of grammar.
The main contribution of this paper is to define and test a new version of WGCS approach, in which the split concept has been employed to reveal the grammar structure. Although the split was used for the first time in [6], its verification was rudimentary and limited due to the unrepresentative bioinformatics dataset. Subsequently, a new approach was formalised and tested over a comprehensive set of artificial CFG datasets, and its computational complexity was given. Moreover, the improved WGCS was compared with two state-of-the-art unsupervised methods—LS [13] and ADIOS [12]—dedicated to CFG learning. Additionally, the rule weight estimation algorithm was improved by mitigating unbalanced data bias.
The rest of the paper is organised as follows. Section 2 gives some details about our approach. In Section 3, we present a test environment and eventually the results are reported in Section 4. Section 5 concludes the paper.

2. Weighted Grammar-Based Classifier System

WGCS belongs to the family of learning classification systems [14] and is based on a previous version of [7] that only works on context-free grammars with no probabilities or weights. According to the idea of grammatical inference, WGCS system receives a set of tagged positive and negative sentences as an input to the system and results is WCFG. In WGCS, all grammar rules are in Chomsky Normal Form (CNF). The induction scheme of this model is shown in Figure 1 and the overall system architecture is shown in Figure 2.

2.1. Weighted Context-Free Grammar

A context-free grammar is a quadruple ( N , T , S , R ) , where N—a finite set of nonterminals symbols disjoint from T, T—a finite set of terminals symbols, S N the start symbol, and R—a finite set of rules of the form X α , where X N and α ( N T ) * . CFG is in CNF when each rule takes one of the two following forms: X Y Z where X , Y , Z N or X t where X N and t T .
A WCFG associates a positive number called the weight with each rule in R (assigning a weight of zero to a rule equates to excluding it from R). More formally, the WCFG is a 5-tuple ( N , T , S , R , W ) , where ( N , T , S , R ) is a CFG and W is a finite set of weights of each rule resulting from a function ϕ ( X α ) w , where X α R and w > 0 is a positive weight.

2.2. Grammar Initialisation

Grammar in the WGCS system is initialised in two ways. The first way is to load a previously prepared grammar from a file. The second way is to generate it automatically in the application. Based on the training set, the symbols in this set are terminal symbols of the grammar, while their uppercase representations are nonterminal symbols. Then, to generate the terminal rules, each nonterminal symbol is assigned to each terminal symbol. On the other hand, nonterminal rules are generated by all possible combinations of all nonterminal symbols. According to [15], the number of all production rules of the CFG is O ( L 3 ) , where L is the length of the input sentence. However, it should be noted that generating all productions is a one-time operation and does not affect the complexity of the method. In practice, the number of generated rules in the inference process is significantly less than the upper limit. Theoretically, the number of production rules in comparative methods (LS and ADIOS) is bounded by O ( L ) .

2.3. Stochastic CKY Parser

To verify whether a given sentence belongs to a specific grammar, special algorithms called parsers are used. One of the most common CFG parsers based on dynamic programming is the Cocke–Kasami–Younger (CKY) parser [16,17]. Its extension used to parse stochastic CFGs is Stochastic CKY, first described in [18]. Both classical and stochastic CKY algorithms assume grammar to be in CNF. The stochastic CKY algorithm is used in WGCS system and its operation is represented by Algorithm 1.
Algorithm 1: Stochastic CKY
1:
Load the sentence and grammar
2:
L sentence length
3:
| N | number of nonterminal symbols
4:
Create an array CKY[L][L]
5:
Create an array wCKY[L][L][ | N | ]
6:
 
7:
for i 1 to L do
8:
    for w i in s e n t e n c e do                   ▹ s e n t e n c e = w 1 w L
9:
        for A w i in T R do                  ▹ T R = t e r m i n a l r u l e s
10:
           write A in C K Y [ i ] [ 1 ]
11:
           write ϕ ( A w i ) in w C K Y [ i ] [ 1 ] [ A ]               ▹ rule weight
12:
        end for
13:
    end for
14:
end for
15:
 
16:
for i 2 to L do
17:
    for j 1 to L i + 1 do
18:
        for k 2 to i 1 do
19:
           for A B C in N R do             ▹ N R = n o n - t e r m i n a l r u l e s
20:
               if w C K Y [ i ] [ k ] [ B ] > 0 and w C K Y [ k ] [ j ] [ C ] > 0 then
21:
                   write A in C K Y [ i ] [ j ]
22:
                   write ϕ ( A B C ) × w C K Y [ i ] [ k ] [ B ] × w C K Y [ k ] [ j ] [ C ] in w C K Y [ i ] [ j ] [ A ]
23:
               end if
24:
           end for
25:
        end for
26:
    end for
27:
end for

2.4. Split Algorithm

This method is based on [19,20], where grammar is induced incrementally. During each iteration of the algorithm, a new X j nonterminal symbol is created from another X i nonterminal symbol through a split operation. The symbol selected for the split operation is the symbol most often used in rule weight estimation (having the largest count) (see line 2 in Algorithm 2). This symbol is generally called the split symbol. Then, for all X i t terminal rules, we create new terminal rules, replacing X i with X j (see lines 3–5 in Algorithm 2). Next, new nonterminal rules are created in two ways:
  • For symbols X i and X j , create all possible rules (see line 6 in Algorithm 2). Since the rules are in CNF, their number is 8.
  • For all nonterminal rules with X i in the form X a X b X c , where X a , X b or X c is X i , create new untimely rules in the same form, replacing X i with X j . For multiple occurrences of X i in a rule, create all combinations (see lines 7–20 in Algorithm 2).
Algorithm 2: Split algorithm
1:
Select a nonterminal symbol X i with the largest count               ▹ Split symbol
2:
Create new nonterminal symbol X j
3:
for X i t in T R do                         ▹ T R = t e r m i n a l r u l e s
4:
    Create new terminal rule X j t
5:
end for
6:
Create all possible nonterminal rules from two nonterminal symbols X i and X j :
X i X i X i , X i X i X j , X i X j X i , X i X j X j , X j X i X i , X j X i X j , X j X j X i ,
X j X j X j
7:
for X a X b X c in N R do                    ▹ N R = n o n - t e r m i n a l r u l e s
8:
    if X a = = X i X b = = X i then
9:
        Create new nonterminal rules: X j X j X c , X j X i X c , X i X j X c
10:
    else if X a = = X i X c = = X i then
11:
        Create new nonterminal rules: X j X b X j , X j X b X i , X i X b X i
12:
    else if X b = = X i X c = = X i then
13:
        Create new nonterminal rules: X a X j X j , X a X j X i , X a X i X j
14:
    else if X a = = X i then
15:
        Create new nonterminal rule X j X b X c
16:
    else if X b = = X i then
17:
        Create new nonterminal rule X a X j X c
18:
    else if X c = = X i then
19:
        Create new nonterminal rule X a X b X j
20:
    end if
21:
end for
To illustrate the split method, suppose there is the set of rules: R = { Y B C , Y Y C , B D Y , S Y Y , Y a , B b , Y b } , the set of nonterminals N = { Y , B , C , D } , the set of terminals T = { a , b } , and the start symbol S. We select the symbol with the largest count (let it be Y) and create a new symbol—a split symbol—Z. According to the lines 3–5 of the Algorithm 2, new terminal rules are generated: { Z a , Z b } . The new nonterminal rules are generated as follows.
  • From Y and split symbol Z create: Y Y Y , Y Y Z , Y Z Y , Y Z Z , Z Z Z , Y Y Z , Z Z Y , Z Y Y (line 6 of Algorithm 2).
  • From { Y B C , B D Y } create new following rules { Z B C , B D Z } and from { Y Y C , S Y Y } rules { Z Z C , Z Y C , Y Z C , S Z Z , S Z Y , S Y Z } (lines 7–21 of Algorithm 2).
The result is: R = { Y Y Y , Y Y Z , Y Y Z , Y Z Y , Y Z Z , Z Z Z , Z Z Y , Z Y Y , Z Z C , Z Y C , Y Z C , S Z Z , S Z Y , S Y Z , Y B C , Y Y C , B D Y , S Y Y , Y a , B b , Y b , Z a , Z b } , N = { Z , Y , B , C , D } , T = { a , b } , S = S .

2.5. Rule Weight Estimation

After establishing he grammar structure, we can focus on fine-tuning the weights of the rules. The most common algorithm used for this purpose is inside–outside. It is a special case of the Expectation-Maximization algorithm designed to estimate the parameters of a stochastic context-free grammar, originally the probabilities of the rules, and in our case, the rule weights. Two algorithms will be described in this subsection—the original inside–outside algorithm and its extended version using negative sentences when estimating rule weights used in the WGCS system.

2.5.1. Inside–Outside

Baker introduced the inside–outside algorithm [21]. Its computational complexity is O ( L 3 | N | 3 ) , where L is the sentence length and | N | is the number of nonterminal symbols in the grammar [22].
The inside–outside algorithm starts the estimation process from the initial probabilities/weights of the rules (usually assigned randomly). At each iterative step, it updates the probability/weight of the rule based on the frequency of the rule in the training set. To better understand the algorithm, let us introduce the basic nomenclature.
  • Probability/weight of the rule:
    for nonterminal rules: ϕ ( X Y Z )
    for terminal rules: ϕ ( X x )
  • Probability/weight of deriving a sentence from grammar:
    P ( W ) = P ( S w 1 w 2 w n )
    where ⇒ stands for sentence derivation, W stands for sentence output, and w 1 w 2 w n are the individual words of the sentence W.
  • The inside probability is the probability of deriving from a given symbol the nonterminal sequence of words w i w j from the sentence W = w 1 w n :
    β i j ( X ) = P ( X w i w j )
    where X is any nonterminal grammar symbol.
    Figure 3 shows the graphical interpretation of the inside probability for the nonterminal Y symbol, β i j ( Y ) .
  • The outside probability is the probability of deriving from the starting symbol the string w 1 w i 1 X w j + 1 w n from the sentence W = w 1 w n :
    α i j ( X ) = P ( S w 1 w i 1 X w j + 1 w n )
    Figure 4 shows the graphical representation of the outside probability for the nonterminal symbol Y, α i j ( Y ) .
  • Estimated number of uses of the rule determines how often the rule occurs for a single sentence:
    for terminal rules:
    c ϕ ( X x , W ) = ϕ ( X x ) P ( W ) i 1 β i i ( X )
    for nonterminal rules:
    c ϕ ( X Y Z , W ) = ϕ ( X Y Z ) P ( W ) 1 i j k n α i k ( X ) β i j ( Y ) β j + 1 , k ( Z )
  • The total estimated number of uses of the rule determines how often the rule occurs in all sentences in the training set:
    c o u n t ( X α ) = i = 1 n c ϕ ( X α , W i )
    where X α stands for a terminal or nonterminal rule and W i for successive sentences in the training set.
  • The new weight/probability of a rule is calculated as the ratio of the total estimated uses of a given rule to the sum of the estimated total uses of a rule with the same left-hand symbol:
    ϕ ( X α ) = c o u n t ( X α ) γ c o u n t ( X γ )
    where X γ stands for a rule with the same left-hand side symbol as the rule in the numerator and any right-hand side form ( g a m m a ) of a rule in a CNF, either a terminal symbol or two nonterminal symbols.

2.5.2. Inside–Outside Contrastive Estimation

The inside–outside contrastive estimation (IOCE) algorithm is an extended version of the inside–outside algorithm to include the use of negative sentences in the estimation of rule weights. This approach is inspired by works using the classic contrastive estimation method [23,24]. However, it differs significantly from the solutions proposed in those works.
In IOCE, we introduce the so-called negative estimation factor:
ψ ( X α ) = c o u n t ( X α ) c o u n t ( X α ) + θ × c o u n t n e g a t i v e ( X α )
where c o u n t n e g a t i v e ( X α ) determines the total estimated number of uses of the rule in all negative sentences in the training set and θ = n u m b e r _ o f _ p o s i t i v e _ s e n t e n c e s n u m b e r _ o f _ n e g a t i v e _ s e n t e n c e s is introduced to mitigate imbalanced datasets bias.
Using this coefficient, we calculate the new weight of the rule:
φ ( X α ) = c o u n t ( X α ) β c o u n t ( X β ) · ψ ( X α )
The general idea of the negative estimation coefficient is that, if the rule often appears in the set of negative sentences, the coefficient is smaller. By multiplying the coefficient by the current weight of the rule, we reduce its weight. When the rule does not appear even once in the set of negative sentences, the coefficient is equal to 1 and the weight of the rule does not change.

2.6. Removing Rules with Low Weight

In the WGCS system with a split algorithm, the grammar size increases with each iteration, which significantly affects the computational complexity of IO/IOCE algorithms. Therefore, to prevent slowing down of the system and maintain good quality sentence classification, the WGCS system has implemented a mechanism that cleans the grammar from rules with low weights. If a rule gains a weight below the threshold, the rule is removed from the system. There are two thresholds for deleting rules, one for nonterminal rules 0.001 and another for terminal rules 0.000001. These values have been determined experimentally.

2.7. Experimental Protocol and Complexity Analysis

WCFG is learned using WGCS according to the experimental protocol described in Algorithm 3. The run-time complexity for the worst-case scenario of the given algorithm can be evaluated as follows. Say that k is the number of iterations of the WGCS algorithm, | G | —the size of the grammar, z—the number of sentences in the training set, n—the number of IOCE iterations, | N | —the number of nonterminal symbols, L—the length of the sentence, and y—the number of sentences in the validation set.
Algorithm 3: Experimental protocol
1:
Load the initial grammar and datasets
2:
for i 1 to i t e r a t i o n s do          ▹ iterations = 20
3:
    Run the split algorithm
4:
    Run IOCE on the training set              ▹ 200
5:
    Remove rules with low weights
6:
    Test grammar with CKY on the training set
7:
end for
8:
Test best grammar with CKY on the validation set
In the algorithm above, for a worst-case evaluation it should be assumed that run-time of the split algorithm (line 3) is bounded by | G | , IOCE algorithm (line 4) is bounded by z · n · | N | 3 L 3 , removing rules (line 5) by | G | , testing grammar (line 6) by z · L 3 | G | , and testing the best grammar (step 8) by y · L 3 | G | . Thus the total amount of time to run lines 1–8 is:
k · ( | G | + z · n · | N | 3 L 3 + | G | + z · L 3 | G | ) + y · L 3 | G |
Note that | G | = k · | T | + k 3 and | N | = k 3 , and the total amount of time can be calculated as follows
k · ( k · | T | + k 3 + z · n · k 3 L 3 + k · | T | + k 3 + z · L 3 ( k · | T | + k 3 ) ) + y · L 3 ( k · | T | + k 3 )
which can be factored as:
k 2 · | T | + k 4 + z · n · k 4 L 3 + k 2 · | T | + k 4 + z · L 3 ( k 2 · | T | + k 4 ) + y · L 3 ( k · | T | + k 3 )
Therefore, the total running time for this algorithm is estimated as:
O ( z · n · | T | · k 4 L 3 + y · | T | · k 3 L 3 )
Note that the maximum number of terminals | T | can be replaced by ( y + z ) L
O ( z · n · ( y + z ) · L · k 4 L 3 + y · ( y + z ) · L · k 3 L 3 )
which reduces to
O ( ( y + z ) · k 3 L 4 ( z · n · k + y ) )
As we can see the complexity of the proposed method is polynomially bounded with respect to the input size.

3. Benchmarks

3.1. Datasets

For our experiments, 28 datasets have been prepared. Most of them were generated based on the random context-free grammars G i obtained from the CFG/TestSet Generator [25]. The target finite samples, that had about 200 words each were constructed as follows. Let Z i = k = 1 K i L i Σ k . The total estimated number of uses for the rule, where K i is an integer from 10 to 20 and L i = L ( G i ) . 100 words, chosen randomly from the set Z i , along with optimal examples given by the generator constituted examples. Let z Z i and y Σ * be words that differ by a few letters—as a consequence of a swap, insertion, or deletion. 100 words y Y i , y L i , 1 | y | K i , generated randomly in this way, constituted counterexamples.
Five languages were generated based on grammars constructed by hand from the following description:
  • L 6 : balanced parentheses
  • L 8 : { w : w   i s   a   palindromeand w { a , b } { a , b } + }
  • L 9 : { w : w { a , b } + a n d a ( w ) = b ( w ) }
  • L 10 : { w : w { a , b } + a n d 2 a ( w ) = b ( w ) }
  • L 11 : the language of ukasiewicz ( S a S S ; S b )
Languages L 6 ,   L 8 ,   L 9 , and L 10 were considered by Nakamura and Matsumoto [26], and L 11 was considered by Eyraud et al. [27]. Table 1 shows our settings in this respect.

3.2. Brief Description of Other Approaches

In [13], Wieczorek described a local search (LS) approach. In this study, we will use a simple example to present this method using a simple example. Assume that the set { a b , a b a b } constitutes examples while the set { a , b , b a , a b a } constitutes counterexamples. The first step is to construct a grammar that generates all the examples. A special algorithm has been devised for this purpose. It could produce the following grammar: S A B , A a , B C D , C b , D A C | E , and E ϵ . Further, in a loop, two variables are merged as long as the grammar can be shortened. In the examples, B and C (into B), S and D, and S and E, we get the grammar: S A B | ϵ , A a , B b | B S . Finally, unnecessary variables and rules are removed from the resultant grammar (in the example the rule S ϵ ). Every step is controlled by means of counterexamples to obtain valid grammar.
The Automatic DIstillation Of Structure (ADIOS) model that uses only examples builds syntactic representations of a sample of language from unlabelled data [28]. It consists of two elements: (1) a Representational Data Structure (RDS) graph and (2) a Pattern Acquisition (PA) algorithm that constructs the RDS in an unsupervised manner. The goal of the PA algorithm is to detect patterns, i.e., repetitive sequences of “significant” strings occurring in the examples. Here, the PA algorithm is related to prior work on alignment-based learning and regular expression extraction from strings. However, the authors of ADIOS stress claim, that their algorithm requires no prejudging of either the scope of the primitives or their classification. In the initial phase of the PA algorithm, the examples are segmented down to the smallest possible morphological constituents. In the second phase, the PA algorithm repeatedly scans the RDS graph for common patterns, which are then used to modify the graph. ADIOS algorithm has been tested on a variety of linguistic and bioinformatics data with promising results.
The code of WGCS and LS along with the benchmarks are available at [29]. The code of ADIOS is available on request from the authors of this method.

4. Results

Our experiments were performed on Intel Core i7-7567U CPU, 3.5 GHz processor, with 32 GB RAM under Windows 10 operating system. Three methods, i.e., our proposal WGCS and two references methods: local search (LS) and ADIOS, were used to infer grammars for 28 benchmark datasets. A five-fold crossvalidation was performed on each set and the results were averaged. To evaluate the quality classification of the compared methods, we use the classification results stored in a confusion matrix. Four scores were defined as tp, fp, fn, and tn, representing the numbers of true positives (correctly recognised positive sentences), false positives (negatives recognised as positives), false negatives (positives recognised as negatives), and true negatives (correctly recognised negatives), respectively. Based on the values stored in the confusion matrix, we calculate the widely used Precision, Recall (Sensitivity), and combined metric F1-score. Precision is defined as P = t p / ( t p + f p ) , Recall (Sensitivity) as R = t p / ( t p + f n ) , and F1 as the harmonic mean of Precision and Sensitivity F 1 = 2 · ( P · R / ( P + R ) ) . Table 2 shows these results with respect to Precision (Pr), Recall (Rc), and F1 score. This table additionally shows the average production number and the average computation time obtained for each tested grammar by all methods. The average number of productions and the average computation time were calculated over five folds of the crossvalidation method used.
To find out whether the observed differences are statistically significant, we follow the Wilcoxon-signed-rank test [30] for WGCS vs. LS and WGCS vs. ADIOS. In this test, the null hypothesis ( H 0 ) states that the difference between the pairs follows a symmetric distribution around zero. The alternative hypothesis ( H 1 ), on the other hand, states that the difference between the pairs does not follow a symmetric distribution around zero (i.e., the difference is not a coincidence). As can we see in Table 3, p-values are small enough (all below 0.025 ) to reject H 0 . Therefore, we can conclude that WGCS performs better than the two competing methods on prepared benchmarks, although it is a slower method than ADIOS.

5. Conclusions

We have formalized and verified the split method in weighted context-free grammar induction. The new approach to weighted CFG learning has been applied in the frame of the Weighted Grammar-based Classifier System. Additionally, the inside–outside contrastive estimation algorithm was improved by correcting unbalanced data bias. The experiments conducted over 28 context-free languages showed that WGCS with splitting outperforms the state-of-the-art methods in terms of F1 scores.
Further work is ongoing to investigate the use of the combined split-merge method in discovering WCFG. It should be noted that the split mechanism leads to an overlinear increase in the number of generated productions. It is also worth noting that grammar splitting is focused on specialising grammar production, whereas grammar merging can generalise the model by merging some nonterminals. Grammar merging seems to be a promising approach to pruning unwanted structures [31].

Author Contributions

Conceptualisation, O.U. and M.G.; methodology, O.U. software, M.G. and W.W.; validation, M.G. and O.U.; formal analysis, O.U.; investigation, M.G. and O.U.; resources, M.G. and W.W.; writing—original draft preparation, M.G. and W.W. and O.U.; writing—review and editing, O.U.; supervision, O.U.; project administration, O.U.; funding acquisition, O.U. All authors have read and agreed to the published version of the manuscript.

Funding

This research was supported by National Science Center (Poland), grant number 2016/21/B/ST6/02158.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The data presented in this study are available in [29].

Conflicts of Interest

The authors declare no conflict of interest.

Abbreviations

The following abbreviations are used in this manuscript:
IOInside-Outside algorithm
CFGContext-Free Grammar
CNFChomsky Normal Form
CKYCocke–Kasami–Younger parser
WCFGWeighted Context-Free Grammar
WGCSWeighted Grammar-based Classifier System
IOCEInside-Outside Contrastive Estimation algorithm

References

  1. Flasiński, M. Introduction to Artificial Intelligence; Springer: Berlin/Heidelberg, Germany, 2016. [Google Scholar]
  2. de la Higuera, C. Grammatical Inference: Learning Automata and Grammars; Cambridge University Press: Cambridge, UK, 2010. [Google Scholar] [CrossRef]
  3. Gold, E.M. Language identification in the limit. Inf. Control. 1967, 10, 447–474. [Google Scholar] [CrossRef] [Green Version]
  4. Horning, J.J. A Study of Grammatical Inference; Technical Report; Stanford University California Department of Computer Science: Stanford, CA, USA, 1969. [Google Scholar]
  5. Unold, O.; Gabor, M.; Wieczorek, W. Unsupervised Statistical Learning of Context-free Grammar. In Proceedings of the 12th International Conference on Agents and Artificial Intelligence—Volume 1: NLPinAI; INSTICC; SciTePress: Setúbal, Portugal, 2020; pp. 431–438. [Google Scholar]
  6. Unold, O.; Gabor, M.; Dyrka, W. Unsupervised Grammar Induction for Revealing the Internal Structure of Protein Sequence Motifs. In Proceedings of the International Conference on Artificial Intelligence in Medicine, Minneapolis, MN, USA, 25–28 August 2020; Springer: Berlin/Heidelberg, Germany, 2020; pp. 299–309. [Google Scholar]
  7. Unold, O. Context-free grammar induction with grammar-based classifier system. Arch. Control. Sci. 2005, 15, 681–690. [Google Scholar]
  8. Unold, O. Fuzzy grammar-based prediction of amyloidogenic regions. In Proceedings of the International Conference on Grammatical Inference, College Park, MD, USA, 5–8 September 2012; pp. 210–219. [Google Scholar]
  9. Unold, O.; Gabor, M. How implicit negative evidence improve weighted context-free grammar induction. In Proceedings of the International Conference on Artificial Intelligence and Soft Computing, Zakopane, Poland, 16–20 June 2019; Springer: Berlin/Heidelberg, Germany, 2019; pp. 595–606. [Google Scholar]
  10. Van Zaanen, M. ABL: Alignment-based learning. In Proceedings of the 18th Conference on Computational Linguistics, Saarbrucken, Germany, 31 July–4 August 2000; Volume 2, pp. 961–967. [Google Scholar]
  11. Adriaans, P.; Vervoort, M. The EMILE 4.1 grammar induction toolbox. In Proceedings of the International Colloquium on Grammatical Inference, Amsterdam, The Netherlands, 23–25 September 2002; Springer: Berlin/Heidelberg, Germany, 2002; pp. 293–295. [Google Scholar]
  12. Solan, Z.; Horn, D.; Ruppin, E.; Edelman, S. Unsupervised learning of natural languages. Proc. Natl. Acad. Sci. USA 2005, 102, 11629–11634. [Google Scholar] [CrossRef] [Green Version]
  13. Wieczorek, W. A Local Search Algorithm for Grammatical Inference. In Grammatical Inference: Theoretical Results and Applications, Proceedings of the 10th International Colloquium (ICGI 2010), Valencia, Spain, 13–16 September 2010; Lecture Notes in Computer Science; Jose, M., Sempere, P.G., Eds.; Springer: Berlin/Heidelberg, Germany, 2010; Volume 6339, pp. 217–229. [Google Scholar]
  14. Urbanowicz, R.J.; Moore, J.H. Learning classifier systems: A complete introduction, review, and roadmap. J. Artif. Evol. Appl. 2009, 2009, 1. [Google Scholar] [CrossRef]
  15. Sakakibara, Y. Learning context-free grammars using tabular representations. Pattern Recognit. 2005, 38, 1372–1383. [Google Scholar] [CrossRef]
  16. Kasami, T. An Efficient Recognition and Syntax-Analysis Algorithm for Context-Free Languages; Coordinated Science Laboratory Report No. R-257; University of Illinois at Urbana-Champaign: Champaign, IL, USA, 1966. [Google Scholar]
  17. Younger, D.H. Recognition and parsing of context-free languages in time n3. Inf. Control 1967, 10, 189–208. [Google Scholar] [CrossRef] [Green Version]
  18. Ney, H. Dynamic programming parsing for context-free grammars in continuous speech recognition. IEEE Trans. Signal Process. 1991, 39, 336–340. [Google Scholar] [CrossRef]
  19. Hogenhout, W.R.; Matsumoto, Y. A fast method for statistical grammar induction. Nat. Lang. Eng. 1998, 4, 191–209. [Google Scholar] [CrossRef]
  20. Kurihara, K.; Sato, T. Variational Bayesian grammar induction for natural language. In Proceedings of the International Colloquium on Grammatical Inference, Tokyo, Japan, 20–22 September 2006; Springer: Berlin/Heidelberg, Germany, 2006; pp. 84–96. [Google Scholar]
  21. Baker, J.K. Trainable grammars for speech recognition. J. Acoust. Soc. Am. 1979, 65, S132. [Google Scholar] [CrossRef] [Green Version]
  22. Lari, K.; Young, S.J. The estimation of stochastic context-free grammars using the inside-outside algorithm. Comput. Speech Lang. 1990, 4, 35–56. [Google Scholar] [CrossRef]
  23. Smith, N.A.; Eisner, J. Contrastive estimation: Training log-linear models on unlabeled data. In Proceedings of the 43rd Annual Meeting on Association for Computational Linguistics, Ann Arbor, MI, USA, 25–30 June 2005; pp. 354–362. [Google Scholar]
  24. Smith, N.A.; Eisner, J. Guiding unsupervised grammar induction using contrastive estimation. In Proceedings of the IJCAI Workshop on Grammatical Inference Applications, Edinburgh, UK, 31 July 2005; pp. 73–82. [Google Scholar]
  25. Unold, O.; Kaczmarek, A.; Culer, Ł. Iterative method of generating artificial context-free grammars. arXiv 2019, arXiv:1911.05801. [Google Scholar]
  26. Nakamura, K.; Matsumoto, M. Incremental learning of context free grammars based on bottom-up parsing and search. Pattern Recognit. 2005, 38, 1384–1392. [Google Scholar] [CrossRef]
  27. Eyraud, R.; de la Higuera, C.; Janodet, J.C. LARS: A learning algorithm for rewriting systems. Mach. Learn. 2007, 66, 7–31. [Google Scholar] [CrossRef] [Green Version]
  28. Solan, Z.; Ruppin, E.; Horn, D.; Edelman, S. Automatic Acquisition and Efficient Representation of Syntactic Structures. In Neural Information Processing Systems 15, Proceedings of the Neural Information Processing Systems (NIPS 2002), Vancouver, BC, Canada, 9–14 December 2002; Becker, S., Thrun, S., Obermayer, K., Eds.; MIT Press: Cambridge, MA, USA, 2002; pp. 91–98. [Google Scholar]
  29. Unold, O. jGCS. 2019. Available online: https://github.com/ounold/jGCS (accessed on 22 January 2021).
  30. Rey, D.; Neuhäuser, M. Wilcoxon-Signed-Rank Test. In International Encyclopedia of Statistical Science; Lovric, M., Ed.; Springer: Berlin/Heidelberg, Germany, 2011; pp. 1658–1659. [Google Scholar] [CrossRef]
  31. Zaanen, M.; Noord, N. Model merging versus model splitting context-free grammar induction. In Proceedings of the International Conference on Grammatical Inference, College Park, MD, USA, 5–8 September 2012; pp. 224–236. [Google Scholar]
Figure 1. Induction in WGCS model.
Figure 1. Induction in WGCS model.
Applsci 11 01030 g001
Figure 2. General architecture of the WGCS system.
Figure 2. General architecture of the WGCS system.
Applsci 11 01030 g002
Figure 3. Graphical representation of the inside probability.
Figure 3. Graphical representation of the inside probability.
Applsci 11 01030 g003
Figure 4. Graphical representation of the outside probability.
Figure 4. Graphical representation of the outside probability.
Applsci 11 01030 g004
Table 1. Datasets metrics.
Table 1. Datasets metrics.
DatasetSizePositive
Sentences
Negative
Sentences
Max. Length
of Sentence
Min. Length
of Sentence
Number
of Terminals
12131131001834
22201201001822
32041041001442
42401401002045
52081081002084
620010010020122
7198981002044
82001001001432
92001001001662
1020010010020112
112001001002012
122041041002046
132051051002034
142001001002033
152001001002035
162161161002027
17197971002033
182061061002055
192401401001222
202091091002064
212131131002056
222051051002074
232091091002055
24199991002033
252071071001636
262001001002022
27190901001625
282241241001856
Table 2. Average grammar size (|G|), Precision (Pr), Recall (Rc), F1, and average time ([[hh:]mm:]ss) for WGCS, LS and ADIOS.
Table 2. Average grammar size (|G|), Precision (Pr), Recall (Rc), F1, and average time ([[hh:]mm:]ss) for WGCS, LS and ADIOS.
SetWGCSLSADIOS
|G|PrRcF1Time|G|PrRcF1Time|G|PrRcF1Time
1250.991.000.9919:1816.81.000.990.9926:59:0728.20.900.980.941.2
2470.990.980.9914:5475.00.980.880.9397:54:3733.80.631.000.772.0
3161.001.001.001:4334.80.990.900.9456:44:1434.40.511.000.682.4
440.60.980.990.9716:1219.41.001.001.007:22:3526.40.601.000.753.0
5380.980.980.981:41:5310.21.001.001.0019:06:5730.00.521.000.684.5
611.21.001.001.005:43132.01.000.480.614:37:0125.20.51.000.674.3
719.21.001.001.0048:3128.21.000.940.972:50:3726.40.491.000.664.7
856.60.940.950.942:21:4392.90.790.510.6189:22:1624.20.501.000.674.0
941.20.760.900.811:51:15192.40.200.020.042:24:3820.60.501.000.676.9
1042.40.850.930.884:13:26192.20.200.010.022:21:3131.00.501.000.675.9
117.81.000.990.991:05:3967.40.990.780.8616:53:5329.60.501.000.676.0
1221.40.970.990.981:23:4716.01.000.990.991:59:2024.20.561.000.726.0
13400.970.990.981:05:189.81.000.990.9915:26:2027.80.511.000.687.8
1442.20.990.980.981:27:5884.00.960.710.8049:18:1227.80.501.000.678.7
15570.960.910.931:22:2626.00.990.920.9531:39:1023.20.501.000.677.7
1657.20.980.930.9647:2912.81.001.001.004:18:3532.20.560.980.7110.5
1740.20.970.990.9852:3393.50.980.820.8886:43:1320.60.491.000.668.4
1827.61.001.001.005:5326.21.000.910.952:46:5821.20.511.000.689.3
1965.40.960.890.9217:0382.90.840.610.7088:28:5023.40.580.000.738.5
20640.960.900.931:56:2112.41.000.990.9975:31:1820.80.521.000.6910.2
2146.80.991.000.9955:2715.21.001.001.0062:32:2325.00.601.000.748.5
2240.20.981.000.991:08:2414.01.000.960.9817:09:2424.00.511.000.6810.7
2323.40.970.990.9820:5914.81.000.990.9946:38:0225.00.521.000.6910.5
2450.60.880.950.911:17:2075.80.980.710.8228:55:2828.00.501.000.6611.5
2554.60.980.880.9216:0817.01.000.990.9938:25:1324.20.521.000.6812.7
26480.870.970.912:15:20122.00.990.530.6884:07:5128.40.501.000.6716.0
2729.80.990.980.984:4318.21.000.960.9818:43:4721.00.471.000.6412.3
2830.40.960.970.9818:0725.81.001.001.0018:21:5823.40.551.000.7111.2
Avg38.70.960.970.961:01:5954.60.920.810.8535:37:5926.10.540.960.707.7
Table 3. Obtained p values for F1 from Wilcoxon signed-rank test.
Table 3. Obtained p values for F1 from Wilcoxon signed-rank test.
WGCS vs.
LS
WGCS vs.
ADIOS
LS vs.
ADIOS
1.87 × 10−23.74 × 10−61.81 × 10−3
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Gabor, M.; Wieczorek, W.; Unold, O. Split-Based Algorithm for Weighted Context-Free Grammar Induction. Appl. Sci. 2021, 11, 1030. https://doi.org/10.3390/app11031030

AMA Style

Gabor M, Wieczorek W, Unold O. Split-Based Algorithm for Weighted Context-Free Grammar Induction. Applied Sciences. 2021; 11(3):1030. https://doi.org/10.3390/app11031030

Chicago/Turabian Style

Gabor, Mateusz, Wojciech Wieczorek, and Olgierd Unold. 2021. "Split-Based Algorithm for Weighted Context-Free Grammar Induction" Applied Sciences 11, no. 3: 1030. https://doi.org/10.3390/app11031030

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop