Update README.md
Browse files
README.md
CHANGED
@@ -2,4 +2,68 @@
|
|
2 |
license: other
|
3 |
license_name: wikimedia
|
4 |
license_link: https://dumps.wikimedia.org/legal.html
|
|
|
|
|
|
|
5 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
license: other
|
3 |
license_name: wikimedia
|
4 |
license_link: https://dumps.wikimedia.org/legal.html
|
5 |
+
language:
|
6 |
+
- 'no'
|
7 |
+
- nb
|
8 |
---
|
9 |
+
|
10 |
+
# This is a FAISS vectordb from a Norwegian Wikipedia dump from 2023-09 embedded with NbAiLab/nb-sbert-base.
|
11 |
+
### This can be used to augment a chatbot with RAG (norwegian bokmål language).
|
12 |
+
|
13 |
+
Only the article abstracts are processed, but they seemed detailed enough. The 'url' in the metadata points to the original article.
|
14 |
+
Each abstract is embedded as a 768 dimensional vector with this model: NbAiLab/nb-sbert-base
|
15 |
+
|
16 |
+
### Example usage (Python):
|
17 |
+
|
18 |
+
```python
|
19 |
+
|
20 |
+
from langchain_community.vectorstores import FAISS
|
21 |
+
from langchain_community.embeddings import HuggingFaceEmbeddings
|
22 |
+
import time
|
23 |
+
|
24 |
+
embedder = HuggingFaceEmbeddings(model_name='NbAiLab/nb-sbert-base')
|
25 |
+
|
26 |
+
qs = [
|
27 |
+
'Kven er Beyonce?',
|
28 |
+
'Hva skjedde i 2012?',
|
29 |
+
'Hvilke musikkfestivalar kan du anbefale?',
|
30 |
+
]
|
31 |
+
|
32 |
+
db = FAISS.load_local('nowiki_faiss_sbert_all', embedder, allow_dangerous_deserialization=True)
|
33 |
+
|
34 |
+
starttime=time.time()
|
35 |
+
|
36 |
+
for q in qs :
|
37 |
+
print('----\n',q)
|
38 |
+
r = db.similarity_search_with_score(q)
|
39 |
+
print(r)
|
40 |
+
|
41 |
+
print('questions took ',time.time()-starttime,' s. ')
|
42 |
+
|
43 |
+
```
|
44 |
+
|
45 |
+
### More info about the Wikipedia source:
|
46 |
+
|
47 |
+
https://dumps.wikimedia.org/
|
48 |
+
|
49 |
+
https://dumps.wikimedia.org/other/enterprise_html/
|
50 |
+
|
51 |
+
### License and guidelines:
|
52 |
+
|
53 |
+
https://dumps.wikimedia.org/legal.html
|
54 |
+
|
55 |
+
https://foundation.wikimedia.org/wiki/Legal:Developer_app_guidelines
|
56 |
+
|
57 |
+
### Embedder model:
|
58 |
+
|
59 |
+
https://huggingface.co/NbAiLab/nb-sbert-base
|
60 |
+
|
61 |
+
### FAISS vectordb:
|
62 |
+
|
63 |
+
https://python.langchain.com/docs/integrations/vectorstores/faiss
|
64 |
+
|
65 |
+
---
|
66 |
+
license: other
|
67 |
+
license_name: wikimedia
|
68 |
+
license_link: https://dumps.wikimedia.org/legal.html
|
69 |
+
---
|