Skip to content

Commit

Permalink
Merge pull request #89 from LR-POR/issue-85
Browse files Browse the repository at this point in the history
Added punctuation support
  • Loading branch information
leoalenc authored Feb 14, 2023
2 parents 5be777c + a8e58a0 commit 63905c6
Show file tree
Hide file tree
Showing 27 changed files with 17,867 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Version.lsp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; -*- Mode: TDL; Coding: utf-8 -*-
(in-package :common-lisp-user)

(defparameter *grammar-version* "Portuguese (2022-08-10)")
(defparameter *grammar-version* "PorGram (2023-02-13)")
12 changes: 12 additions & 0 deletions lexicon/punct-lex.tdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
period-pct := pt-period-le &
[ STEM < "." > ].

qmark-pct := pt-qmark-le &
[ STEM < "?" > ].

bang-pct := pt-bang-le &
[ STEM < "!" > ].

comma-pct := pt-comma-le &
[ STEM < "," > ].

1 change: 1 addition & 0 deletions my-portuguese-pet.tdl
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
:include "lexicon/random-sample-209-entries".
:include "lexicon/new-ditrans".
:include "lexicon/my-adjectives".
:include "lexicon/punct-lex".
:end :instance.

;;
Expand Down
96 changes: 94 additions & 2 deletions my-portuguese.tdl
Original file line number Diff line number Diff line change
Expand Up @@ -911,5 +911,97 @@ a-que-cl-verb-lex := subj-cl-verb-lex & clausal-nom-verb-lex & clausal-second-ar
; NH-DTR.SYNSEM.NON-LOCAL.QUE.LIST #que ].

basic-adjective-lex :+
[ SYNSEM.NON-LOCAL.QUE.LIST < > ].

[ SYNSEM.NON-LOCAL [ SLASH.LIST < >,
QUE.LIST < >,
REL.LIST < > ] ].

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Additions for punctuation
;;

synsem-min :+
[ PUNCT punctuation-min ].

punct-hd := head.

punct-word := word &
[ INFLECTED infl-satisfied,
SYNSEM [ LOCAL [ CAT [ HEAD punct-hd,
VAL [ SUBJ < >, SPR < >, SPEC < >,
COMPS < expressed-synsem &
[ OPT - ] > ] ],
CONT [ HOOK.INDEX event-or-ref-index,
RELS.LIST < >,
HCONS.LIST < >,
ICONS.LIST < > ] ],
NON-LOCAL non-local-none ] ].

punct-mark := avm &
[ PSF iforce ].

punctuation-min := avm.
punctuation := punctuation-min &
[ LPUNCT punct-mark,
RPUNCT punct-mark ].

comma-or-clause := punct-mark.
comma-or-no-punct := punct-mark.
comma-punct := comma-or-clause & comma-or-no-punct.
clause-or-no-punct := punct-mark.
clause-punct := comma-or-clause & clause-or-no-punct.
no-punct := comma-or-no-punct & clause-or-no-punct.

punct-right-word := punct-word &
[ SYNSEM [ LOCAL.CAT.POSTHEAD +,
PUNCT [ LPUNCT no-punct,
RPUNCT punct-mark ] ] ].

punct-left-word := punct-word &
[ SYNSEM [ LOCAL.CAT.POSTHEAD -,
PUNCT [ LPUNCT punct-mark,
RPUNCT no-punct ] ] ].

punct-right-clause-word := punct-right-word &
[ SYNSEM [ LOCAL.CAT.VAL.COMPS < [ PUNCT.RPUNCT clause-or-no-punct ] >,
PUNCT.RPUNCT clause-punct ] ].

pt-comma-le := punct-right-word &
[ SYNSEM [ LOCAL.CAT.VAL.COMPS < [ PUNCT.RPUNCT no-punct ] >,
PUNCT [ LPUNCT no-punct,
RPUNCT comma-punct ] ] ].

prop-or-comm := iforce.
prop := prop-or-ques & prop-or-comm.
comm := prop-or-comm.

pt-period-le := punct-right-clause-word &
[ SYNSEM.PUNCT.RPUNCT.PSF prop-or-comm ].

pt-qmark-le := punct-right-clause-word &
[ SYNSEM.PUNCT.RPUNCT.PSF ques ].

pt-bang-le := punct-right-clause-word &
[ SYNSEM.PUNCT.RPUNCT.PSF prop-or-comm ].

punct-phrase := phrase &
[ SYNSEM [ LOCAL #local,
NON-LOCAL #nonlocal,
LIGHT #light,
MODIFIED #modif ],
PT-DTR.SYNSEM.LOCAL.CAT [ HEAD punct-hd,
VAL.COMPS < #synsem > ],
NONPT-DTR [ INFLECTED #infl,
SYNSEM #synsem & [ LOCAL #local,
NON-LOCAL #nonlocal,
LIGHT #light & +,
MODIFIED #modif ] ],
INFLECTED #infl ].

punct-hinit-rule := punct-phrase &
[ PT-DTR #ptdtr,
NONPT-DTR #nonptdtr,
ARGS < #nonptdtr, #ptdtr > ].

;;
;; End additions for punctuation
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14 changes: 13 additions & 1 deletion repp/vanilla.rpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,19 @@
;;; to your choices file.
;;;
;;;
:[ \t!"#$%&'()\*\+,\./:;<=>?@\[\]\^_`{|}~\\]
;;;:[ \t!"#$%&'()\*\+,\./:;<=>?@\[\]\^_`{|}~\\]
:[ \t]+
!^(.+)$ \1
!\t
! +

#1
! ([^ (]+)(\)) ([^ ]|$) \1 \2 \3
! ([^ \[]+)(]) ([^ ]|$) \1 \2 \3
!([^ ])([\]}?!,,、;:@#$€¢£¥%&”"’'_]) ([^ ]|$) \1 \2 \3
!([^ ])([\]}?!,,、;:@#$€¢£¥%&”"’'_])([–-])([^ ]|$) \1 \2 \3 \4
!([^ ])(\.) ([\])}”"’'… ]*)(⌊.⌋)*$ \1 \2 \3\4
!(^|[^ ]) ([\[({:@#$€¢£¥%&\*“‘])([^ ]) \1 \2 \3
#

>1
2 changes: 2 additions & 0 deletions rules.tdl
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ ex-subj := extracted-subj-phrase.
wh-ques := wh-ques-phrase.

in-situ-ques := insitu-int-cl.

hd-pct := punct-hinit-rule.
Empty file added tsdb/gold/core/analysis
Empty file.
Empty file added tsdb/gold/core/daughter
Empty file.
35 changes: 35 additions & 0 deletions tsdb/gold/core/decision
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
110@-1@1@7@head-spec@@3@5@23-6-2013 14:28:24
160@-1@1@7@normadp1-norm-adposition-lex@@3@4@23-6-2013 14:28:24
160@-1@1@7@subj-head@@0@6@23-6-2013 14:28:24
170@-1@1@7@zero-refl-mark-lex\sinfl-inf-3sg-suffix\strans-verb-lex@@10@11@23-6-2013 14:28:24
170@-1@1@7@zero-refl-mark-lex\sinfl-inf-3sg-suffix\sde-ditrans-second-arg-raising-verb-lex@@6@7@23-6-2013 14:28:24
180@-1@1@7@zero-refl-mark-lex\sinfl-inf-3sg-suffix\strans-verb-lex@@6@7@23-6-2013 14:28:24
210@-1@1@7@zero-refl-mark-lex\sinfl-inf-3sg-suffix\strans-verb-lex@@7@8@23-6-2013 14:28:24
280@-1@1@7@zero-refl-mark-lex\sinfl-inf-3sg-suffix\strans-verb-lex@@7@8@23-6-2013 14:28:24
340@-1@1@7@zero-refl-mark-lex\sinfl-inf-3sg-suffix\strans-verb-lex@@6@7@23-6-2013 14:28:24
350@-1@1@7@zero-refl-mark-lex\sinfl-inf-3sg-suffix\strans-verb-lex@@6@7@23-6-2013 14:28:24
360@-1@1@7@zero-refl-mark-lex\sinfl-inf-3sg-suffix\strans-verb-lex@@6@7@23-6-2013 14:28:24
370@-1@1@7@zero-refl-mark-lex\sinfl-inf-3sg-suffix\strans-verb-lex@@6@7@23-6-2013 14:28:24
380@-1@1@7@zero-refl-mark-lex\sinfl-inf-3sg-suffix\strans-verb-lex@@6@7@23-6-2013 14:28:24
610@-1@1@7@zero-refl-mark-lex\sperf-ind-3pl-suffix\strans-verb-lex@@2@3@23-6-2013 14:28:24
790@-1@1@7@zero-refl-mark-lex\sperf-ind-3pl-suffix\strans-verb-lex@@2@3@23-6-2013 14:28:24
800@-1@1@7@zero-refl-mark-lex\sperf-ind-3pl-suffix\strans-verb-lex@@2@3@23-6-2013 14:28:24
810@-1@1@7@zero-refl-mark-lex\sperf-ind-3pl-suffix\strans-verb-lex@@2@3@23-6-2013 14:28:24
820@-1@1@7@zero-refl-mark-lex\sperf-ind-3pl-suffix\strans-verb-lex@@2@3@23-6-2013 14:28:24
900@-1@1@7@zero-refl-mark-lex\sperf-ind-3pl-suffix\snonrefl-int-verb-lex@@3@4@23-6-2013 14:28:24
910@-1@1@7@zero-refl-mark-lex\sperf-ind-3pl-suffix\snonrefl-int-verb-lex@@3@4@23-6-2013 14:28:24
960@-1@1@7@zero-refl-mark-lex\sperf-ind-3pl-suffix\snonrefl-int-verb-lex@@3@4@23-6-2013 14:28:24
1010@-1@1@7@zero-refl-mark-lex\sperf-ind-3pl-suffix\strans-verb-lex@@2@3@23-6-2013 14:28:24
1020@-1@1@7@decl-head-opt-subj\szero-refl-mark-lex\spres-ind-1pl-suffix\snonrefl-int-verb-lex@@0@1@23-6-2013 14:28:24
1090@-1@1@7@refl-mark-3-suffix\sperf-ind-3pl-suffix\srefl-com-obj-verb-lex@@0@1@23-6-2013 14:28:24
1100@-1@1@7@zero-refl-mark-lex\sperf-ind-3pl-suffix\strans-verb-lex@@2@3@23-6-2013 14:28:24
1230@-1@1@7@obl-case-marking-adp-lex@@4@5@23-6-2013 14:28:24
1250@-1@1@7@zero-refl-mark-lex\spres-ind-3sg-suffix\sinf-trans-first-arg-control-verb-lex@@1@2@23-6-2013 14:28:24
1310@-1@1@7@obl-case-marking-adp-lex@@5@6@23-6-2013 14:28:24
1330@-1@1@7@zero-refl-mark-lex\spres-ind-3pl-suffix\sinf-trans-first-arg-control-verb-lex@@1@2@23-6-2013 14:28:24
1340@-1@1@7@zero-refl-mark-lex\sperf-ind-3pl-suffix\sinf-trans-first-arg-control-verb-lex@@2@3@23-6-2013 14:28:24
1350@-1@1@7@refl-mark-3-suffix\sperf-ind-3pl-suffix\srefl-int-verb-lex@@1@2@23-6-2013 14:28:24
1400@-1@1@7@zero-refl-mark-lex\sperf-ind-3pl-suffix\strans-verb-lex@@2@3@23-6-2013 14:28:24
1440@-1@1@7@zero-refl-mark-lex\sperf-ind-3pl-suffix\strans-verb-lex@@2@3@23-6-2013 14:28:24
1450@-1@1@7@zero-refl-mark-lex\sperf-ind-3pl-suffix\strans-verb-lex@@2@3@23-6-2013 14:28:24
1470@-1@1@7@decl-head-opt-subj\szero-refl-mark-lex\sinfl-inf-1sg-suffix\snonrefl-int-verb-lex@@2@3@23-6-2013 14:28:24
Loading

0 comments on commit 63905c6

Please sign in to comment.