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
bb026b57
Commit
bb026b57
authored
Apr 29, 2023
by
Jonathan Poalses
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added initial functions for handling dialect detection
parent
85952bbe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
6 deletions
+29
-6
dialect_nlp.clj
src/poalses/jonathan/dialect/dialect_nlp.clj
+28
-5
main.clj
src/poalses/jonathan/dialect/main.clj
+1
-1
No files found.
src/poalses/jonathan/dialect/dialect_nlp.clj
View file @
bb026b57
...
@@ -30,6 +30,27 @@
...
@@ -30,6 +30,27 @@
"ner"
]
"ner"
]
:quote
{
:extractUnclosedQuotes
"true"
}}))
:quote
{
:extractUnclosedQuotes
"true"
}}))
;; Take a dependency graph object and change it into a map of tokens and parts of speech labels
(
defn
dependency-to-token-pos-map
[
graph
])
;; Take a dependency graph object and change it into a map of tokens and relation labels
(
defn
dependency-to-token-relation-map
[
graph
])
;; Take a text sample and separate it into it's sentences, then for each sentence find its dialect, and return the most common dialect
(
defn
detect-sample-dialect
[
sample
])
;; Take a sentence and figure out its dialect
(
defn
detect-sentence-dialect
[
sentence
])
(
def
annotated-example
(
def
annotated-example
(
delay
(
nlp
example
)))
(
delay
(
nlp
example
)))
...
@@ -48,8 +69,8 @@
...
@@ -48,8 +69,8 @@
(
def
sentences-two
(
def
sentences-two
(
delay
(
dl/sentences
@
annotated-example-two
)))
(
delay
(
dl/sentences
@
annotated-example-two
)))
(
defn
show-
mention
s
[]
(
defn
show-
dependencie
s
[]
(
clojure.pprint/pprint
(
map
dl/mentions
@
sentences
)))
(
clojure.pprint/pprint
(
dl/dependency-graph
(
nth
sentences-one
1
)
)))
(
comment
(
comment
...
@@ -67,14 +88,16 @@
...
@@ -67,14 +88,16 @@
(
map
dl/lemma
@
sentences
)
(
map
dl/lemma
@
sentences
)
(
map
dl/lemma
sentences-one
)
(
map
dl/lemma
sentences-one
)
(
map
dl/lemma
@
sentences-two
)
(
map
dl/lemma
@
sentences-two
)
(
dl/t
okens
(
nth
sentences-one
1
))
(
dl/t
ext
(
dl/tokens
(
nth
sentences-one
1
)
))
(
map
dl/tokens
@
sentences-two
)
(
map
dl/tokens
@
sentences-two
)
(
->>
(
mapcat
dl/triples
@
sentences
)
(
map
triple->datalog
))
(
->>
(
mapcat
dl/triples
@
sentences
)
(
map
triple->datalog
))
(
dl/annotation
CorefCoreAnnotations$CorefChainAnnotation
@
annotated-example
)
(
dl/annotation
CorefCoreAnnotations$CorefChainAnnotation
@
annotated-example
)
(
show-
mention
s
)
(
show-
dependencie
s
)
sentences-one
(
dl/text
sentences-one
)
(
dl/triples
sentences-one
)
(
dl/triples
(
dl/dependency-graph
(
nth
sentences-one
1
)))
;; Datafy the annotations. Retrieves direct annotations for every sentence.
;; Datafy the annotations. Retrieves direct annotations for every sentence.
;; Keep in mind that `dl/recur-datafy` currently doesn't work in this instance
;; Keep in mind that `dl/recur-datafy` currently doesn't work in this instance
...
...
src/poalses/jonathan/dialect/main.clj
View file @
bb026b57
...
@@ -71,7 +71,7 @@
...
@@ -71,7 +71,7 @@
(
let
[
shutdown-trigger
(
promise
)
(
let
[
shutdown-trigger
(
promise
)
_bye-testing-hack
(
future
(
Thread/sleep
6000
)
(
deliver
shutdown-trigger
true
))]
_bye-testing-hack
(
future
(
Thread/sleep
6000
)
(
deliver
shutdown-trigger
true
))]
(
log/info
"Dialect Detector started up."
)
(
log/info
"Dialect Detector started up."
)
(
nlp/show-
mention
s
)
(
nlp/show-
dependencie
s
)
@
shutdown-trigger
@
shutdown-trigger
(
log/info
"Dialect Detector shutting down..."
))
(
log/info
"Dialect Detector shutting down..."
))
(
catch
Exception
e
(
catch
Exception
e
...
...
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