Hostname: page-component-77f85d65b8-9nbrm Total loading time: 0 Render date: 2026-03-28T21:12:22.903Z Has data issue: false hasContentIssue false

CNL2ASP: Converting Controlled Natural Language Sentences into ASP

Published online by Cambridge University Press:  20 December 2023

SIMONE CARUSO
Affiliation:
DIBRIS, University of Genova, Genova, Italy (e-mail: simone.caruso@edu.unige.it)
CARMINE DODARO
Affiliation:
DeMaCS, University of Calabria, Rende, Italy (e-mail: carmine.dodaro@unical.it)
MARCO MARATEA
Affiliation:
DIBRIS, University of Genova, Genova, Italy DeMaCS, University of Calabria, Rende, Italy (e-mail: marco.maratea@unical.it)
MARCO MOCHI
Affiliation:
DIBRIS, University of Genova, Genova, Italy (e-mail: marco.mochi@edu.unige.it)
FRANCESCO RICCIO
Affiliation:
Engineering Division, ALTEN Italia, Torino, Italy (e-mail: riccio.francesco@outlook.it)
Rights & Permissions [Opens in a new window]

Abstract

Answer set programming (ASP) is a popular declarative programming language for solving hard combinatorial problems. Although ASP has gained widespread acceptance in academic and industrial contexts, there are certain user groups who may find it more advantageous to employ a higher-level language that closely resembles natural language when specifying ASP programs. In this paper, we propose a novel tool, called CNL2ASP, for translating English sentences expressed in a controlled natural language (CNL) form into ASP. In particular, we first provide a definition of the type of sentences allowed by our CNL and their translation as ASP rules and then exemplify the usage of the CNL for the specification of both synthetic and real-world combinatorial problems. Finally, we report the results of an experimental analysis conducted on the real-world problems to compare the performance of automatically generated encodings with the ones written by ASP practitioners, showing that our tool can obtain satisfactory performance on these benchmarks.

Information

Type
Original Article
Creative Commons
Creative Common License - CCCreative Common License - BY
This is an Open Access article, distributed under the terms of the Creative Commons Attribution licence (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted re-use, distribution and reproduction, provided the original article is properly cited.
Copyright
© The Author(s), 2023. Published by Cambridge University Press
Figure 0

Fig. 1. Architecture of the tool CNL2ASP.

Figure 1

Fig. 2. Time comparison of the performance of the original, the optimized, and the CNL encodings to solve instances of the NSP.

Figure 2

Table 1. Comparison of time (in seconds) employed by the original encoding and by the CNL encoding to compute a solution within 10 steps or to prove that there is no solution

Figure 3

Fig. 3. Time comparison of the performance of the original and CNL encodings to solve instances of the CTS problem.

Figure 4

Table 2. Results on the usability test. Each row represents the results of an individual participant. A value of “1” indicates that the provided ASP rule/CNL specification was correct, while “0” indicates that it was incorrect

Figure 5

Table 3. Results on the readability test. Each row represents the results of an individual participant. A “1” indicates that the participant correctly identified the truth or falsity of the corresponding statement, while “0” denotes an incorrect or an empty response

Figure 6

Table 4. Comparison of the linguistic features of CNL2ASP, $\lambda$-based (Baral and Dzifcak 2012), BIOQUERYCNL (Erdem and Yeniterzi 2009), and PENG$^\mathrm{ASP}$ (Schwitter 2018). Yes (Y) means the construct is supported, No (N) means that the construct is not supported, Unknown (U) means that there is no evidence that the construct is supported nor unsupported

Supplementary material: PDF

Caruso et al. supplementary material

Appendix A

Download Caruso et al. supplementary material(PDF)
PDF 149.2 KB