Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
Major Project Handcrafted
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
jonathan.poalses
Major Project Handcrafted
Commits
99155e50
Commit
99155e50
authored
May 08, 2023
by
Jonathan Poalses
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed the word predicates to be one of the predicates in the vectors rather than a separate check
parent
f78d0f9a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
13 deletions
+10
-13
dialect_nlp.clj
src/poalses/jonathan/dialect/dialect_nlp.clj
+10
-13
No files found.
src/poalses/jonathan/dialect/dialect_nlp.clj
View file @
99155e50
...
@@ -53,32 +53,29 @@
...
@@ -53,32 +53,29 @@
(
def
american-words
#
{
"like"
})
(
def
american-words
#
{
"like"
})
(
def
australian-word-predicate
#
(
some
australian-words
(
dl/text
(
dl/tokens
%
))))
(
def
scottish-word-predicate
#
(
some
scottish-words
(
dl/text
(
dl/tokens
%
))))
(
def
american-word-predicate
#
(
some
american-words
(
dl/text
(
dl/tokens
%
))))
(
defn
fake-test
(
defn
fake-test
[
fake
]
[
fake
]
false
)
false
)
;; Predicate vectors to check a sentence and see if it grammatically matches a dialect
;; Predicate vectors to check a sentence and see if it grammatically matches a dialect
(
def
australian-predicates
[
fake-test
])
(
def
australian-predicates
[
fake-test
australian-word-predicate
])
(
def
scottish-predicates
[
fake-test
])
(
def
scottish-predicates
[
fake-test
scottish-word-predicate
])
(
def
american-predicates
[
fake-test
])
(
def
american-predicates
[
fake-test
american-word-predicate
])
;; Take a sentence and figure out its dialect
;; Take a sentence and figure out its dialect
(
defn
detect-sentence-dialect
[
sentence
]
(
defn
detect-sentence-dialect
[
sentence
]
(
let
[
token-text
(
dl/text
(
dl/tokens
sentence
))
(
let
[
dialects1
(
when
((
apply
some-fn
australian-predicates
)
sentence
)
:australian
)
dialects1
(
if
(
some
australian-words
token-text
)
dialects2
(
when
((
apply
some-fn
scottish-predicates
)
sentence
)
:scottish
)
:australian
dialects3
(
when
((
apply
some-fn
american-predicates
)
sentence
)
:american
)
(
when
((
apply
some-fn
australian-predicates
)
sentence
)
:australian
))
dialects2
(
if
(
some
scottish-words
token-text
)
:scottish
(
when
((
apply
some-fn
scottish-predicates
)
sentence
)
:scottish
))
dialects3
(
if
(
some
american-words
token-text
)
:american
(
when
((
apply
some-fn
american-predicates
)
sentence
)
:american
))
dialects
(
remove
nil?
[
dialects1
dialects2
dialects3
])]
dialects
(
remove
nil?
[
dialects1
dialects2
dialects3
])]
(
if
(
empty?
dialects
)
(
if
(
empty?
dialects
)
[
:standard
]
[
:standard
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment