Update README.md
Browse files
README.md
CHANGED
@@ -1,6 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
Output:
|
2 |
|
3 |
-
|
4 |
|
5 |
### How was it trained?``
|
6 |
|
|
|
1 |
+
# Flexudy's Conceptor: Towards Neuro-Symbolic Language Understanding
|
2 |
+
|
3 |
+
![alt text](https://www.flexudy.com/wp-content/uploads/2021/09/conceptor.png "Flexudy's conceptor")
|
4 |
+
|
5 |
+
At [Flexudy](https://flexudy.com), we look for ways to unify symbolic and sub-symbolic methods to improve model interpretation and inference.
|
6 |
+
|
7 |
+
## Problem
|
8 |
+
|
9 |
+
1. Word embeddings are awesome 🚀. However, no one really knows what an array of 768 numbers means?
|
10 |
+
2. Text/Token classification is also awesome ❤️. Still, classifying things into a finite set of concepts is rather limited.
|
11 |
+
3. Last but not least, how do I know that the word *cat* is a **mammal** and also an **animal** if my neural network is only trained to predict whether something is an animal or not?
|
12 |
+
|
13 |
+
## Solution
|
14 |
+
|
15 |
+
1. It would be cool if my neural network would just know that **cat** is an **animal** right? *∀x.Cat(x) ⇒ Animal(x)*.
|
16 |
+
Or for example, (*∀x.SchöneBlumen(x) ⇒ Blumen(x)*) -- English meaning: For all x, If x is a beautiful flower, then x is still a flower. --
|
17 |
+
|
18 |
+
2. All of a sudden, tasks like **Question Answering**, **Summarization**, **Named Entity Recognition** or even **Intent Classification** etc become easier right?
|
19 |
+
|
20 |
+
Well, one might probably still need time to build a good and robust solution that is not as large as **GPT3**.
|
21 |
+
|
22 |
+
Like [Peter Gärdenfors, author of conceptual spaces](https://www.goodreads.com/book/show/1877443.Conceptual_Spaces), we are trying to find ways to navigate between the symbolic and the sub-symbolic by thinking in concepts.
|
23 |
+
|
24 |
+
Should such a solution exist, one could easily leverage true logical reasoning engines on natural language.
|
25 |
+
|
26 |
+
How awesome would that be? 💡
|
27 |
+
|
28 |
+
## Flexudy's Conceptor
|
29 |
+
|
30 |
+
1. We developed a poor man's implementation of the ideal solution described above.
|
31 |
+
2. Though it is a poor man's model, **it is still a useful one** 🤗.
|
32 |
+
|
33 |
+
### Usage
|
34 |
+
|
35 |
+
No library should anyone suffer. Especially not if it is built on top of **HF Transformers**.
|
36 |
+
|
37 |
+
|
38 |
+
Go to the [Github repo](https://github.com/flexudy/natural-language-logic)
|
39 |
+
```python
|
40 |
+
from core.conceptor.start import FlexudyConceptInferenceMachineFactory
|
41 |
+
|
42 |
+
# Load me only once
|
43 |
+
concept_inference_machine = FlexudyConceptInferenceMachineFactory.get_concept_inference_machine()
|
44 |
+
|
45 |
+
# A list of terms.
|
46 |
+
terms = ["cat", "dog", "economics and sociology", "public company"]
|
47 |
+
|
48 |
+
# If you don't pass the language, a language detector will attempt to predict it for you
|
49 |
+
# If any error occurs, the language defaults to English.
|
50 |
+
language = "en"
|
51 |
+
|
52 |
+
# Predict concepts
|
53 |
+
# You can also pass the batch_size=2 and the beam_size=4
|
54 |
+
concepts = concept_inference_machine.infer_concepts(terms, language=language)
|
55 |
+
```
|
56 |
+
|
57 |
Output:
|
58 |
|
59 |
+
```{<br/>'cat': ['mammal', 'animal'], <br/> 'dog': ['hound', 'animal'], <br/>'economics and sociology': ['both fields of study'], <br/>'public company': ['company']<br/>}```
|
60 |
|
61 |
### How was it trained?``
|
62 |
|