# Leveraging Retrieval-Augmented Generation for Swahili Language Conversation Systems
## 5 Implementation
### Document Chunking and Vectorization  
Table 11 and Figure 18 illustrate the process of document chunking and vectorization within the Retrieval-Augmented Generation (RAG) framework. Table 11 presents a side-by-side comparison of Swahili text chunks and their English translations, ensuring clarity for bilingual evaluation. Figure 18 shows how these text chunks are embedded into vector representations for efficient retrieval. _The electric light bulb was invented by [PERSON] in 1879, although there were earlier innovations related to electric lights. [PERSON] created a practical electric light system, building on prior inventis. However, before [PERSON], other scientists like [PERSON] had discovered electric light using batteries and carbon filaments. [PERSON] improved his invention by extending the bulb's lifespan and creating a practical electric grid for cities. [PERSON], who worked briefly under [PERSON], became a major opponent of [PERSON] in the development of AC (alternating current) systems versus DC (direct current). [PERSON] contributed significantly to the development of AC technology, which ultimately prevailed for long-distance use._  
_The history of electric power began with the invention of the battery and the experiments of [PERSON] on electromagnetism. [PERSON] discovered the basic principles of electromagnetism, which made it possible to generate electricity using a generator. In the 19 th century, scientists and inventors carried out significant experiments to improve electrical technology. [PERSON] discovered the first volatile battery, which enabled the production of continuous electricity. [PERSON] and [PERSON] led the electrical revolution through their debates on AC and DC systems. [PERSON] advocated for the use of the AC system due to its ability to transmit electricity over long distances with minimal energy loss. On the other hand, [PERSON] emphasized the use of the DC system, believing it was safer for household use._ \begin{table}
\begin{tabular}{c c} \hline
**Swahili Text** & **English Translation** \\ \hline Taa y aumeme ilivumbuliwa na [PERSON] mwaka wa 1879, ingawa kulikuwa na uvumbuzi wa awali unaohusiana na taa zumeme. [PERSON] aliunda mfuno wa mwanga wa umeme \\ unaoweza kutumika kwa viterondo, akizingatia mwendelezo wa \\ uvumbuzi wa awali. Hata hivyo, kabla y [PERSON], wanasayansi \\ wengine kama [PERSON] waligundua mwanga wa \\ umeme kupitia betri na filamenti za kaboni. [PERSON] alifanya \\ uvumbuzi wake kuwa bora zaidi kwa kuongeza naisha ya \\ balbu a kuttengeneza matandao wa umeme wairetdo kwa \\ miji. [PERSON], ambaye alifanya kazi kwa muda chini ya \\ [PERSON], aikuwa mpinzani mkubuwa wa [PERSON] katika \\ maendejo va mififumo ya AC (umeme wa kubadilishana) dhidi \\ ya DC (umeme wa moja kwa moja). [PERSON] alichangia kwa \\ kiwango kikubwa teknolojia ya umeme wa AC, ambayo \\ hatimaye ikashinda kwa matumizi ya umbali mrefu. \\ \hline Historia ya nishati ya umeme ilianzia na uvumbuzi wa betri na \\ majribio ya [PERSON] kuhusu sumakuumeme. [PERSON] \\ aligundua kanuni za msingi za sumakuumeme, ambazo \\ zilitiranya iweezekane kuzalisha umeme kwa kutumia jenetra. \\ Kaitka karma ya 19, wanasayansi na wamyubuzi walifanya \\ majaridiro mlnakubwa ya kubrosenka teknolojia ya umeme. \\ [PERSON] aligundua betiri ya kwanza ya voltaic, ambayo \\ ilifanikisha uazalishai wa umeme wa mara kwa mara. [PERSON] na [PERSON] waliongoza mapinduzi ya umeme \\ kupitia mabishano yao kuhusu mifumo ya AC na DC. [PERSON] \\ alihimiza matumizi ya mfuno wa AC kwa sabbau ya uwezo \\ wake wa kusafirisha umeme kwa umbali mrefu bila hasara \\ kubwa ya nishati. Kwa upande mwingine, [PERSON] alisiisitiza \\ matumizi ya mfuno wa DC, aikamini kuwa \\ zaidi kwa matumizi ya nymbani. \\ \hline \end{tabular}
\end{table} 
Table 11: Swahili text and its English translation for retrieval purposes. This table presents a segment of Swahili text alongside its English translation, both of which are organized for efficient retrieval within the Retrieval-Augmented Generation (RAG) framework.