Public
Edited
Dec 23, 2023
1 fork
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import { N,D,A,Pro,V,Adv,P,C,Q,DT,NO, // Constructeurs de terminaux
S,SP,CP,VP,NP,AP,AdvP, // Constructeurs de non-terminaux
root,subj,det,mod,comp,coord, // Constructeurs de dépendances
oneOf, // Choix de structure
getLemma,getLanguage,addToLexicon,updateLexicon // Accès au lexique
} from "@lapalme/jsrealb"
Insert cell
Insert cell
Insert cell
N("chat")
Insert cell
Insert cell
function realiser(...args){
return args.map(a=>a.realize()).join(", ")
}
Insert cell
realiser(N("chat"))
Insert cell
Insert cell
realiser(D("un"),
N("chat"),
A("gris"))
Insert cell
Insert cell
realiser(V("aimer"))
Insert cell
Insert cell
realiser(Pro("je"))
Insert cell
Insert cell
realiser(Adv("tellement"),
P("de"),
C("ou"),
Q("Wow!!"))
Insert cell
Insert cell
realiser(DT(),
DT("2020/12/25"))
Insert cell
Insert cell
realiser(NO(123),
NO(45678))
Insert cell
Insert cell
realiser(D("un").g("f"),
N("lapin").n("p"),
A("gris").g("f").n("p"))
Insert cell
Insert cell
realiser(Pro("je").pe(2).n("p"),
V("aimer").t("ps").pe(2).n("p"),
Pro("moi").pe(3),
V("finir").t("f").pe(1).n("p"))
Insert cell
Insert cell
realiser(DT().dOpt({hour:false,minute:false,second:false,nat:true}),
DT("2020/12/25").dOpt({hour:false,minute:false,second:false,nat:false}))
Insert cell
Insert cell
realiser(NO(123).dOpt({nat:true}),
NO(15).dOpt({ord:true}),
NO(3.141592).dOpt({mprecision:4}),
NO(2378).dOpt({rom:true}))
Insert cell
Insert cell
html`${realiser(D('un'),
N("chat").tag("a",
{href:"https://fr.wikipedia.org/wiki/Chat",
target:"_blank"}),
A("gris").tag("i"))}`
Insert cell
Insert cell
Insert cell
np1 = NP(D("le"),
N("souris").n("p"),
A("petit"),
A("gris"))
Insert cell
np2 = NP(D("le"),
N("orange"))
Insert cell
s = S(np1,
VP(V("manger").t("f"),
np2))
Insert cell
Insert cell
realiser(np1,np2,s)
Insert cell
Insert cell
realiser(S(np1,
VP(V("manger").t("f"),
np2)).typ({neg:true,pas:true}))
Insert cell
Insert cell
function np1_f(n){
return NP(D("le"),
N("souris").n(n ?? "s"),
A("petit"),
A("gris"))
}
Insert cell
Insert cell
realiser(np1_f("p"),np1_f())
Insert cell
Insert cell
np2_f = (n) => NP(D("le"), N("orange").n(n ?? "s"))
Insert cell
s_f = (n) => S(np1_f(n),VP(V("manger").t("f"), np2_f(n)))
Insert cell
realiser(s_f("p"),s_f().typ({neg:true,pas:true}))
Insert cell
Insert cell
function afficher(ph_f,modTyp){
return ph_f().typ(modTyp ?? {}).realize();
}
Insert cell
Insert cell
afficher(s_f)
Insert cell
Insert cell
afficher(s_f,{neg:true})
Insert cell
Insert cell
afficher(s_f,{neg:true, pas:true})
Insert cell
Insert cell
afficher(s_f,{int:"wos"})
Insert cell
Insert cell
afficher(s_f,{int:"wad"})
Insert cell
Insert cell
sp_f = () => S(np2_f().add(SP(Pro("que"),
np1_f(),
VP(V("manger").t("pc")))),
VP(V("être"),
A("mûr")))
Insert cell
Insert cell
`S(NP(D('le'),
N('orange').n("s"),
SP(Pro('que'),
NP(D('le'),
N('souris').n("s"),
A('petit'),
A('gris')),
VP(V('manger').t("pc")))),
VP(V('être'),
A('mûr')))`
Insert cell
Insert cell
afficher(sp_f)
Insert cell
Insert cell
afficher(sp_f,{neg:"pas encore"})
Insert cell
Insert cell
afficher(sp_f,{int:"why",neg:true})
Insert cell
Insert cell
cp_f = () => CP(C("et"),
NP(D("le"),N("éléphant")),
NP(D("le"),N("souris")),
NP(D("un"),N("loup")))
Insert cell
Insert cell
afficher(()=>S(cp_f(), VP(V("arriver").t("pc"))))
Insert cell
Insert cell
afficher(() => S(cp_f().add(NP(NO(25).nat(true),
N("chien"))),
VP(V("arriver").t("pc"))))
Insert cell
Insert cell
garcon_f = () => NP(D("le"),N("garçon"),A("beau"))
Insert cell
femme_f = () => NP(D("un"),N("femme"),A("intelligent"))
Insert cell
Insert cell
afficher(() => S(garcon_f(),
VP(V("aimer").t("pc"),
femme_f())))
Insert cell
Insert cell
afficher(() => S(garcon_f().pro(),
VP(V("aimer").t("pc"),
femme_f())))
Insert cell
Insert cell
afficher(() => S(garcon_f().pro(),
VP(V("aimer").t("pc"),
femme_f().pro())))
Insert cell
Insert cell
Insert cell
afficher(()=> root(V("manger").t("i"),
subj(N("chat").n("p"),
det(D("le"))),
comp(N("souris"),
det(D("un")),
mod(A("blanc")))))
Insert cell
Insert cell
afficher(()=>root(V("manger"),
coord(C("et"),
subj(N("garçon"),det(D("le"))),
subj(N("fille"),det(D("le")))),
coord(C("ou"),
comp(N("soupe"),det(D("le"))),
comp(N("légume").n("p"),det(D("un"))),
comp(N("poulet"),det(D("le"),
mod(P("de")).pos("pre"))))),{pas:true,neg:true})
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more