Skip to content

Commit 8bd4247

Browse files
committed
Remove gender-based inference (sex rules and question)
1 parent 7f7993f commit 8bd4247

7 files changed

Lines changed: 48 additions & 91 deletions

File tree

clips/beer-knowledge.clp

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,6 @@
55

66
; determine best beer attributes for user type and scenario recognized
77

8-
(defrule determine-best-beer-attributes-if-which-sex-is-male
9-
(declare (salience ?*medium-low-priority*))
10-
(which-sex male)
11-
=>
12-
(assert (attribute (name best-alcohol) (value noticeable) (certainty .04)))
13-
(assert (attribute (name best-color) (value brown) (certainty .04)))
14-
(assert (attribute (name best-alcohol) (value harsh) (certainty .05)))
15-
(assert (attribute (name best-color) (value dark) (certainty .05)))
16-
(assert (attribute (name best-flavor) (value dark-roasty) (certainty .05)))
17-
(assert (attribute (name best-flavor) (value hoppy-bitter) (certainty .05)))
18-
(assert (attribute (name best-flavor) (value sour-tart-funky) (certainty .05)))
19-
(assert (attribute (name explanation-scenario) (value (str-cat "You're a man, so you'll appreciate more alcoholic "
20-
"beers, maybe with a stronger flavor, such as bitter and sour.")))))
21-
22-
(defrule determine-best-beer-attributes-if-which-sex-is-female
23-
(declare (salience ?*medium-low-priority*))
24-
(which-sex female)
25-
=>
26-
(assert (attribute (name best-alcohol) (value mild) (certainty .04)))
27-
(assert (attribute (name best-color) (value amber) (certainty .04)))
28-
(assert (attribute (name best-alcohol) (value not-detectable) (certainty .05)))
29-
(assert (attribute (name best-color) (value pale) (certainty .05)))
30-
(assert (attribute (name best-flavor) (value crisp-clean) (certainty .05)))
31-
(assert (attribute (name best-flavor) (value malty-sweet) (certainty .05)))
32-
(assert (attribute (name best-flavor) (value fruity-spicy) (certainty .05)))
33-
(assert (attribute (name explanation-scenario) (value (str-cat "You're a woman, so you'll appreciate beers with less "
34-
"noticeable alcohol, maybe with a cleaner or sweeter flavor.")))))
35-
368
(defrule determine-best-beer-attributes-if-which-age-is-18-23
379
(declare (salience ?*medium-low-priority*))
3810
(which-age 18-23)

clips/beer-questions.clp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,6 @@
55

66
; random questions for user type and scenario recognition
77

8-
(defrule random-question-to-determine-which-sex
9-
(start)
10-
(not (which-sex ?sex))
11-
=>
12-
(set-strategy random)
13-
(assert (UI-state (display "Are you male or female? 👨🏻👩🏻")
14-
(why "Male or female persons tend to prefer more or less intense beers.")
15-
(relation-asserted which-sex)
16-
(valid-answers male female))))
17-
188
(defrule random-question-to-determine-which-age
199
(start)
2010
(not (which-age ?age))
@@ -96,7 +86,6 @@
9686
; depth questions for meal type recognition
9787

9888
(defrule determine-main-meal
99-
(which-sex ?sex)
10089
(which-age ?age)
10190
(smoker ?smoker)
10291
(which-season ?season)

clips/labels-it.clp

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
(it "*🔎 Perché queste birre:*"))
2727

2828
; --- scenario questions (display) ---
29-
(translation (en "Are you male or female? 👨🏻👩🏻")
30-
(it "Sei uomo o donna? 👨🏻👩🏻"))
3129
(translation (en "How old are you? 🔞")
3230
(it "Quanti anni hai? 🔞"))
3331
(translation (en "Are you a regular beer drinker? 🍺")
@@ -48,8 +46,6 @@
4846
(it "Che tipo di gusto preferisci in genere?"))
4947

5048
; --- scenario questions (why) ---
51-
(translation (en "Male or female persons tend to prefer more or less intense beers.")
52-
(it "Uomini e donne tendono a preferire birre più o meno intense."))
5349
(translation (en "Younger people tend to prefer less intense beers.")
5450
(it "Le persone più giovani tendono a preferire birre meno intense."))
5551
(translation (en "Better start with more standard beers. On the other hand, you may be surprised!")
@@ -212,16 +208,6 @@
212208

213209
;; Result-explanation sentences (the "for the following reasons" narrative).
214210
(deffacts italian-explanation-labels
215-
(translation (en "Beers with a cleaner flavor may be the good choice while smoking, because the beer may alter the taste of tobacco. Anyway, strong beers pair well with tobacco flavor.")
216-
(it "Le birre dal sapore più pulito possono essere una buona scelta mentre si fuma, perché la birra può alterare il sapore del tabacco. In ogni caso, le birre forti si sposano bene con il tabacco."))
217-
(translation (en "Being so young, you should not appreciate strong flavors or high quantities of alcohol, so I bet you won't be disappointed with these beers.")
218-
(it "Essendo così giovane, non dovresti apprezzare sapori forti o alte quantità di alcol, quindi scommetto che queste birre non ti deluderanno."))
219-
(translation (en "Cold and rainy days are perfect to taste a little more alcoholic beer than the average, with a more particular flavor.")
220-
(it "Le giornate fredde e piovose sono perfette per assaggiare una birra un po' più alcolica della media, con un sapore più particolare."))
221-
(translation (en "Frosty days are perfect to taste something sweet or roasty, that strongly change your palate. Also, high alcoholic beers can heat you up.")
222-
(it "Le giornate gelide sono perfette per assaggiare qualcosa di dolce o tostato, che cambi decisamente il palato. Inoltre, le birre molto alcoliche possono riscaldarti."))
223-
(translation (en "Hotter days are perfect to taste beers with a slight sense of alcohol, with a clean fresh flavor.")
224-
(it "Le giornate più calde sono perfette per assaggiare birre con un leggero senso di alcol, dal sapore pulito e fresco."))
225211
(translation (en "It's a high carbonated beer.")
226212
(it "È una birra molto gasata."))
227213
(translation (en "It's a low carbonated beer.")
@@ -232,8 +218,6 @@
232218
(it "Inoltre, la selvaggina da penna si abbina benissimo a birre con amaro, sapore e aroma di luppolo da medi ad alti, per pulire la bocca."))
233219
(translation (en "Moreover, rich meats comes together with beers that presents pronounced acidity.")
234220
(it "Inoltre, le carni rosse si accompagnano a birre con acidità pronunciata."))
235-
(translation (en "Spring days are perfect to taste beers with clean or spicy flavor, without the clash of too much alcohol.")
236-
(it "Le giornate primaverili sono perfette per assaggiare birre dal sapore pulito o speziato, senza l'urto di troppo alcol."))
237221
(translation (en "That's it because blue cheeses are stronger-flavored cheeses which are most successfully balanced with stronger-flavored bolder beers with a roasty flavor, thanks to the roast of the malt that comes through strong and can produce a delicate bitterness in these beers.")
238222
(it "Questo perché i formaggi erborinati hanno sapori intensi, bilanciati al meglio da birre più decise dal sapore tostato, grazie alla tostatura del malto che emerge con forza e può produrre un amaro delicato in queste birre."))
239223
(translation (en "That's it because chocolate pair well with beers with a sweet flavor, thanks to the prevalent sense of maltiness on the palate, and also with beers which presents a roasty flavor, thanks to the roast of the malt that comes through strong and can produce a delicate bitterness in these beers.")
@@ -290,10 +274,6 @@
290274
(it "Preferisci una birra chiara."))
291275
(translation (en "You prefer an amber beer.")
292276
(it "Preferisci una birra ambrata."))
293-
(translation (en "You're a man, so you'll appreciate more alcoholic beers, maybe with a stronger flavor, such as bitter and sour.")
294-
(it "Sei un uomo, quindi apprezzerai birre più alcoliche, magari dal sapore più deciso, come amaro e acido."))
295-
(translation (en "You're a woman, so you'll appreciate beers with less noticeable alcohol, maybe with a cleaner or sweeter flavor.")
296-
(it "Sei una donna, quindi apprezzerai birre con alcol meno percepibile, magari dal sapore più pulito o dolce."))
297277
(translation (en "You're eating a classic pizza: the best way to enjoy it is pair that with beers that have a very delicate impact on the palate and can sometimes produce a feeling of dryness in the mouth, creating an overall delicate outcome.")
298278
(it "Stai mangiando una pizza classica: il modo migliore per gustarla è abbinarla a birre con un impatto molto delicato al palato, che a volte possono dare una sensazione di secchezza in bocca, creando un risultato complessivamente delicato."))
299279
(translation (en "You're eating a pizza with cheese: the best way to enjoy it is pair that with beers with a spicy flavor, derived from the yeast and dominated by notes of fruit and spice like tart apple, pear, peach, orange, lemon, apricot and clove, pepper, vanilla, coriander, cinnamon, nutmeg, bay leaf.")
@@ -306,12 +286,6 @@
306286
(it "Stai mangiando una pizza con carne piccante: il modo migliore per gustarla è abbinarla a birre dal sapore dolce, grazie al prevalente senso di maltato al palato."))
307287
(translation (en "You're eating a pizza with vegetables: the best way to enjoy it is pair that with beers with a sour flavor, because of the pronounced acidity blended on the palate with the addition of fruity aromas.")
308288
(it "Stai mangiando una pizza con verdure: il modo migliore per gustarla è abbinarla a birre dal sapore acido, per la pronunciata acidità unita al palato con l'aggiunta di aromi fruttati."))
309-
(translation (en "You're supposed to start with standard aromas; afterwards, you'll be ready for something more peculiar.")
310-
(it "Conviene iniziare con aromi standard; in seguito sarai pronto per qualcosa di più particolare."))
311-
(translation (en "Your age let me choose between a variety of beers with high tolerance in every aspect.")
312-
(it "La tua età mi permette di scegliere tra una varietà di birre con alta tolleranza sotto ogni aspetto."))
313-
(translation (en "Your palate could be very demanding: I bet you would try out something peculiar.")
314-
(it "Il tuo palato potrebbe essere molto esigente: scommetto che proveresti qualcosa di particolare."))
315289
)
316290

317291
;; Atomic fragments: welcome, rationale terms/axes/phrases, bot messages.
@@ -351,3 +325,31 @@
351325
(translation (en "Backend set to *%s*. Press /new to start.") (it "Backend impostato su *%s*. Premi /new per iniziare."))
352326
(translation (en "Language set to *%s*. Press /new to start.") (it "Lingua impostata su *%s*. Premi /new per iniziare."))
353327
)
328+
329+
;; Revised scenario + new dessert explanations (English base updated).
330+
(deffacts italian-scenario-explanation-labels
331+
(translation (en "A more experienced palate tends to enjoy complex, assertive styles, so I can suggest something bolder and more peculiar.")
332+
(it "Un palato più esperto tende ad apprezzare stili complessi e decisi, quindi posso suggerirti qualcosa di più audace e particolare."))
333+
(translation (en "At a younger age the palate is usually eased in with approachable, low-alcohol styles with a clean or lightly fruity flavour, rather than intense or very bitter ones.")
334+
(it "In giovane età il palato si abitua meglio a stili accessibili e poco alcolici, dal sapore pulito o leggermente fruttato, piuttosto che intensi o molto amari."))
335+
(translation (en "Autumn is the season of malty amber beers of moderate strength: Marzen and Oktoberfest lagers, spiced pumpkin ales and nutty brown ales.")
336+
(it "L'autunno è la stagione delle birre ambrate e maltate di media gradazione: Märzen e Oktoberfest, ale speziate alla zucca e brown ale dal carattere nocciolato."))
337+
(translation (en "Frosty days are perfect for warming, full-bodied beers: strong, dark and malty or roasty, such as stouts, bocks and barley wines.")
338+
(it "Le giornate gelide sono perfette per birre corpose e riscaldanti: forti, scure e maltate o tostate, come stout, bock e barley wine."))
339+
(translation (en "Hot days call for light, refreshing and very drinkable beers: low in alcohol, crisp and pale, such as pilsners, wheat beers and session ales.")
340+
(it "Le giornate calde chiedono birre leggere, dissetanti e molto bevibili: poco alcoliche, fresche e chiare, come pilsner, birre di frumento e session ale."))
341+
(translation (en "Moreover, creamy desserts pair well with a British-Style Barley Wine, whose sweetness is heightened on the palate.")
342+
(it "Inoltre, i dessert cremosi si abbinano bene a un British-Style Barley Wine, la cui dolcezza viene esaltata al palato."))
343+
(translation (en "Moreover, fruit desserts pair well with fruity and spicy beers, such as wheat ales, witbier and sour beers.")
344+
(it "Inoltre, i dessert alla frutta si abbinano bene a birre fruttate e speziate, come le birre di frumento, le witbier e le birre acide."))
345+
(translation (en "Since you're not a regular beer drinker, I'll start you on approachable, clean and easy-drinking styles, low in bitterness and alcohol; later you'll be ready for something more peculiar.")
346+
(it "Dato che non sei un bevitore abituale di birra, parto da stili accessibili, puliti e facili da bere, poco amari e poco alcolici; più avanti sarai pronto per qualcosa di più particolare."))
347+
(translation (en "Spring calls for fresh, moderately strong beers with a clean or lightly spicy, floral character, such as saisons, Maibocks and pale ales.")
348+
(it "La primavera chiede birre fresche e di media gradazione, dal carattere pulito o leggermente speziato e floreale, come saison, Maibock e pale ale."))
349+
(translation (en "That's it because creamy fruit desserts pair particularly well with a Belgian-Style Fruit Lambic or a British-Style Barley Wine Ale.")
350+
(it "Questo perché i dessert cremosi alla frutta si abbinano particolarmente bene a un Belgian-Style Fruit Lambic o a un British-Style Barley Wine Ale."))
351+
(translation (en "Tobacco dulls the palate and stands up to bold beers, so robust full-flavoured styles pair best while smoking: roasty, malty and stronger beers such as porters, stouts and smoked beers.")
352+
(it "Il tabacco attenua il palato e regge birre decise, quindi gli stili robusti e dal sapore pieno si abbinano meglio mentre si fuma: birre tostate, maltate e più forti come porter, stout e birre affumicate."))
353+
(translation (en "Your age lets me choose from a broad variety of beers, balanced across strength and flavour.")
354+
(it "La tua età mi permette di scegliere tra un'ampia varietà di birre, equilibrate tra gradazione e sapore."))
355+
)

doc/BeerEX.pdf

-294 Bytes
Binary file not shown.

doc/sections/identification.tex

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ \section{Knowledge Acquisition}
2727
tables (the recommended style for each food).
2828

2929
\item \emph{Domain heuristics}: the rules of thumb that relate the user's
30-
scenario---sex, age, drinking habit, smoking habit, season---to the strength
30+
scenario---age, drinking habit, smoking habit, season---to the strength
3131
and flavour profile of an enjoyable beer, distilled into the \emph{why}
3232
rationales attached to the corresponding questions.
3333
\end{itemize}
@@ -38,7 +38,7 @@ \section{Knowledge Acquisition}
3838
three layers:
3939

4040
\begin{enumerate}[nosep]
41-
\item the \textbf{user scenario}---sex, age, whether a regular beer drinker,
41+
\item the \textbf{user scenario}---age, whether a regular beer drinker,
4242
whether smoking, and the season---factors that shift, weakly, the expected
4343
strength and flavour of an enjoyable beer;
4444
\item the \textbf{personal preferences}---preferred colour, alcohol level,
@@ -74,7 +74,6 @@ \section{Knowledge Acquisition}
7474

7575
\multicolumn{3}{l}{\itshape Scenario (asked in random order)}\\
7676
\addlinespace
77-
Sex & \code{which-sex} & male, female. \\
7877
Age & \code{which-age} & 18--23, 24--29, $\geq$30. \\
7978
Regular drinker & \code{regular-beer-drinker} & yes, no. \\
8079
Smoking habit & \code{smoker} & yes, no. \\

doc/sections/implementation.tex

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ \section{Knowledge Base}
123123
The questions (\code{beer-questions.clp}) and the knowledge rules
124124
(\code{beer-knowledge.clp}) are organised in parallel: each question asserts a
125125
\code{UI-state} whose \code{relation-asserted} names the relation it elicits
126-
(e.g. \code{which-sex}), and the corresponding knowledge rule fires on that
126+
(e.g. \code{which-season}), and the corresponding knowledge rule fires on that
127127
relation to assert the \emph{best-*} evidence.
128128

129129
The data-grounded facts are not written by hand but produced by two reproducible
@@ -153,18 +153,18 @@ \section{Inference Engine}
153153
\emph{best-*} evidence. A question rule asserts a \code{UI-state} that records
154154
the relation it elicits; when the user answers, the dialogue machinery
155155
(Section~\ref{sec:ui}) asserts the relation as a plain fact (e.g.
156-
\code{(which-sex male)}); a knowledge rule then matches that fact and asserts the
157-
graded \emph{best-*} attributes. For instance the male-scenario rule contributes
158-
several weighted preferences across the axes:
156+
\code{(which-season winter)}); a knowledge rule then matches that fact and asserts
157+
the graded \emph{best-*} attributes. For instance the winter-scenario rule
158+
contributes several weighted preferences across the axes:
159159

160160
\begin{lstlisting}
161-
(defrule determine-best-beer-attributes-if-which-sex-is-male
161+
(defrule determine-best-beer-attributes-if-which-season-is-winter
162162
(declare (salience ?*medium-low-priority*))
163-
(which-sex male)
163+
(which-season winter)
164164
=>
165-
(assert (attribute (name best-alcohol) (value noticeable) (certainty .04)))
166-
(assert (attribute (name best-color) (value brown) (certainty .04)))
167-
(assert (attribute (name best-flavor) (value hoppy-bitter) (certainty .05)))
165+
(assert (attribute (name best-color) (value dark) (certainty .05)))
166+
(assert (attribute (name best-alcohol) (value harsh) (certainty .05)))
167+
(assert (attribute (name best-flavor) (value malty-sweet) (certainty .05)))
168168
...)
169169
\end{lstlisting}
170170

doc/sections/usage.tex

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -111,20 +111,16 @@ \subsection{A worked consultation}
111111

112112
A full consultation begins with a block of profiling questions ---asked in random
113113
order, since they are independent of one another--- covering the drinker's
114-
profile (sex, age, regular-drinker status, smoking habit, season) and their
114+
profile (age, regular-drinker status, smoking habit, season) and their
115115
personal preferences (colour, alcohol, carbonation, flavour). Once these are
116116
known, the dialogue switches to a depth-first chain of meal questions. The
117117
following command-line transcript drives the profiling questions to the point
118118
where a recommendation is produced; the questions and their options are exactly
119119
those defined in the knowledge base.
120120

121121
\begin{lstlisting}[numbers=none]
122-
Are you male or female?
123-
1.male 2.female 3.why 4.cancel
124-
Answer: 1
125-
126122
How old are you?
127-
1.18-23 2.24-29 3.>=30 4.why 5.cancel 6.prev
123+
1.18-23 2.24-29 3.>=30 4.why 5.cancel
128124
Answer: 3
129125

130126
Are you a regular beer drinker?
@@ -303,19 +299,18 @@ \subsection{Help and Why}
303299
command line) and do not advance the dialogue: after the text is shown, the same
304300
question is asked again.
305301

306-
The \emph{Why} facility is illustrated on the opening question, which asks for the
307-
drinker's sex. Requesting \code{why} prints the rationale and re-poses the
308-
question:
302+
The \emph{Why} facility is illustrated on the age question. Requesting \code{why}
303+
prints the rationale and re-poses the question:
309304

310305
\begin{lstlisting}[numbers=none]
311-
Are you male or female?
312-
1.male 2.female 3.why 4.cancel
306+
How old are you?
307+
1.18-23 2.24-29 3.>=30 4.why 5.cancel
313308
Answer: why
314309

315-
Male or female persons tend to prefer more or less intense beers.
310+
Younger people tend to prefer less intense beers.
316311

317-
Are you male or female?
318-
1.male 2.female 3.why 4.cancel
312+
How old are you?
313+
1.18-23 2.24-29 3.>=30 4.why 5.cancel
319314
Answer: 1
320315
\end{lstlisting}
321316

0 commit comments

Comments
 (0)