Monday morning. An employee types a simple question into the company's new AI assistant: "Yıllık izin hakkım kaç gün?" ("How many days of annual leave am I entitled to?") The assistant answers without a second's hesitation: "Up to 30 days a year." The answer is confident, the Turkish is flawless, and it's completely wrong. 30 days is the cap for unpaid leave. The annual leave policy says 14 to 26 days, depending on seniority.
There's nothing wrong with the assistant's grasp of the language. The problem is in the folder it opened before writing the answer. In this post, using a small experiment we set up ourselves, we explain why that folder got opened wrong, why Turkish makes this job harder, and how it gets fixed.
The Assistant Searches First, Then Writes
Most company assistants work like a careful new intern. When a question comes in, they first go to the filing cabinet, pull out a few files that look relevant, read them, and write the answer based on those files. If they pick the right file, the answer is right. If they pick the wrong file, they write the wrong answer in the same polished sentences.
This setup is called "retrieval-augmented generation," or RAG for short. The idea became widespread with a paper published in 2020, and today it's almost the standard architecture for internal company assistants. This post is about the first half of the job: finding the right file.
36 Documents, 20 Questions, Five Search Methods
We wrote 36 short documents for a fictional company: invoicing rules, leave policies, expense forms, product sheets, and project records. Some were written entirely in capital letters, like old scanned documents. Then we prepared 20 questions employees might ask and marked the correct document for each question in advance. The sample data is synthetic.
We split the questions into four groups: questions containing suffixed words ("faturalarımızdan", "from our invoices"; "raporumu", "my report"), questions targeting documents written in capital letters, questions containing codes and numbers ("PRJ-2041", "E-12 form"), and questions phrased with different words than the document uses. For each method, we checked: is the correct document among the first three documents found? Since the assistant usually reads the first few documents, this is a useful measure.
| Method | Suffixed question (8) | All-caps document (3) | Code, number (5) | Different wording (4) | Total (20) |
|---|---|---|---|---|---|
| Exact word search, standard lowercasing | 6 | 2 | 5 | 0 | 13 |
| Exact word search, Turkish lowercasing | 6 | 3 | 5 | 0 | 14 |
| Character fragment similarity | 8 | 3 | 5 | 2 | 18 |
| Turkish lowercasing and suffix stripping | 8 | 3 | 5 | 3 | 19 |
| Combination of the last two methods | 8 | 3 | 5 | 3 | 19 |
The first row is the default behavior of many off-the-shelf tools: convert words to lowercase and search for exact matches. In 7 of the 20 questions, the correct document didn't make the top three. The leave question from the introduction is one of them. The correct document fell to eighth place, the unpaid leave document came out on top, and the assistant said "30 days."
The second row only converts capital I and lowercase ı according to the Turkish rule. A single letter rule rescued the leave question.
The third and fourth rows are two different fixes. One breaks words into character fragments and looks for similarity; the other cuts off the suffixes at the end of words and searches for the stem. Both solved all of the suffixed questions.
The last row combines the results of these two methods. In this small test, it didn't beat the best single method; it matched it. But it didn't require you to know in advance which method would do well on which question. In a 20-question test, a single question makes a 5-point difference. So read these numbers as pointing in a direction, not as a precise measurement.

Why Is It Hard? In Turkish, One Word Wears Dozens of Disguises
In English, the word "invoice" mostly appears in text as either "invoice" or "invoices." In Turkish, the same word changes shape depending on the sentence: fatura (invoice), faturası (its invoice), faturanın (of the invoice), faturamın (of my invoice), faturalarına (to their invoices), faturalarımızdan (from our invoices). All six of these forms appear in our 36 short documents and 20 questions.
To a program that searches for exact words, "faturamın" is as far from "faturası" as "fatura" is from "kalem" (line item). If they aren't identical letter for letter, there's no match. Looking at the whole text, we counted 446 distinct spellings in a small pile of 694 words. Cutting off the suffixes brings that number down to 343 stems.

And Then There's the Infamous Letter I
Turkish has two separate i's: dotted i with its capital İ, and dotless ı with its capital I. Most software, however, applies the general rule of the Unicode standard by default: capital I becomes lowercase i. Under this rule, the word "ISPARTA" becomes "isparta," whereas the correct Turkish is "ısparta." The word "YILLIK" (annual) becomes "yillik" and doesn't match "yıllık" in the question. That's exactly what caused the error in the introduction.
The dotted capital İ is even sneakier. The standard lowercasing function in Python, a widely used programming language, turns "İSTANBUL" into something 9 characters long instead of the 8-letter "istanbul": an i, an invisible dot added separately on top of it, and the remaining letters. On screen it looks almost the same, but to the computer it's now a different word. This behavior isn't a bug; it's the Unicode standard's deliberate default rule. A separate rule is defined for Turkish and Azerbaijani, but you have to tell the software to use it explicitly.
In the documents in our experiment, all 43 words containing a capital I or İ were lowercased differently under the standard rule than under the Turkish rule. If your documents include old scanned forms, all-caps headings, or official correspondence, this problem exists in your archive too.
How Does It Get Solved?
The solution isn't a single magic model but several simple steps that complement each other.
1. First, Read Turkish Correctly
Before any search runs, both the documents and the questions go through the same cleanup. Letters are lowercased according to the Turkish rule, and suffixes at the end of words are cut off. Think of it like looking up the entry "fatura" in a dictionary instead of "faturalarımızdan." This is called "stemming," and there are ready-made open-source tools for Turkish.
The suffix stripper we used in our test was deliberately kept simple, and it sometimes shortens words too much: it turns "fatura" into "fatur." As long as the question and the document are shortened the same way, that's not a problem. But it treats words with a dropped letter, like "izin" (leave) and "izni" (its leave), as separate stems. In a serious system, this job should be handed to a more mature Turkish stemmer.
You also need to account for how people actually type. Not everyone types with Turkish characters. When we typed the questions without Turkish characters, as in "Maasim hangi gun yatar?" ("When is my salary paid?"), the suffix-stripping word search found no documents at all for that question. The character fragment search, on the other hand, still put the salary document in first place.
2. Put Two Different Librarians to Work
In a good system, search isn't done by a single method. Think of it as asking the same question to two different librarians at the same time.
- The word librarian brings back documents in which the words in the question appear. It's very good with codes, numbers, and proper names. Ask for "PRJ-2041" and it finds exactly that project. The common method for this is a scoring formula called BM25. The word searches in our test use it.
- The meaning librarian looks at meaning, not words. It converts every text into a coordinate made of hundreds of numbers; texts with similar meanings land next to each other on this map. "Maaşım ne zaman yatar?" ("When is my salary paid?") and "Maaşlar ayın son iş günü hesaplara yatırılır" ("Salaries are deposited into accounts on the last business day of the month") sit close together even though they share no words. This method is called vector search or semantic search.
The meaning librarian's weak spot is exactly where the word librarian is strong. In an example given in a study Anthropic published in 2024, for a user asking about the error code "TS-999," semantic search may return general documents about error codes but miss that exact code. In terms of meaning, there isn't much difference between "PRJ-2041" and "PRJ-2014" either; both are "a project number."
We didn't run a real semantic model in our test, because we worked in an environment without internet access and didn't want to put a result we couldn't measure into the table. We used character fragment similarity as a more flexible helper than exact word search. This helper is no substitute for semantic search. The hardest question in the table shows why: the correct document for "İşten ayrılmak istersem kaç hafta önceden haber vermeliyim?" ("If I want to quit, how many weeks' notice should I give?") talks about the "ihbar süresi" (notice period) and the "sözleşmeyi fesheden taraf" (party terminating the contract). Because there are no shared words, none of the methods in our test could put that document in the top three. This is the type of question where semantic search makes its real contribution.
3. Merge the Two Lists Intelligently
The two librarians brought back two separate lists. Which one do we trust? The most common solution is surprisingly simple: each document gets points based on its rank in each list, and the points are added up. The document in first place gets 1/61 points, second place gets 1/62, third place gets 1/63. The researchers who proposed the method in 2009 set the number 60 in the formula during a preliminary trial and kept it fixed. It's still the default value in popular search engines today. The method is called Reciprocal Rank Fusion, or RRF for short.
An example from our test: for the question "Raporumu kime teslim etmeliyim?" ("Who should I submit my report to?"), the suffix-stripping word search saw the stem "rapor" (report) and put a project document about fleet fuel reports in first place. The sick leave report document came second. The character fragment search, on the other hand, ranked the sick leave report first. In the combined score, the sick leave report narrowly edged out the fleet report, 0.03252 to 0.03227, and came out on top.
It worked in the other direction too. For the question "Kursa gitmek istiyorum, şirket öder mi?" ("I want to take a course; will the company pay for it?"), the character fragment search dropped the training budget document to eighth place, while the word search ranked it first. The combined list kept the document in third place. In other words, merging made up for one method's bad day with the other's good day.

Merging isn't magic. When we also added a weak method to the mix, adding the standard-lowercasing word search as a third list, the result dropped from 19 to 17. A bad list can spoil the good lists. What you merge matters more than how you merge it.
4. Leave the Final Call to a Careful Reader
Large systems have one more step. The first few dozen or few hundred documents from the merged list are handed to a second model that is slower but more careful. This model reads the question and the document side by side and scores them: "does this document really answer this question?" Think of it like hiring: first hundreds of résumés are screened quickly, then the people on the shortlist are interviewed one by one. This step is called reranking.
In the experiment Anthropic published, the top 150 candidates were reranked and the best 20 were passed to the model. When word and semantic search were used together and context was added to the documents, the rate at which the information sought failed to make the top 20 results dropped from 5.7 percent to 2.9 percent. With reranking added, that rate fell to 1.9 percent. This experiment was run on English data. For Turkish, you need to run your own measurements.
Four Things That Break It in Real Life
Everything up to this point has been search technique. But some problems come not from search but from the documents themselves.
1. The Document Gets Split in the Wrong Place
Assistants don't read long documents as they are; they split them into small chunks and search those chunks. Cutting a 40-page personnel policy every 500 words is easy, but it's dangerous. The "Annual leave" heading might end up in one chunk and the table giving the number of days by seniority in the next. The second chunk no longer says what the days are for. The fix is to split the document by its headings and add to the start of each chunk which section of which document it comes from.
2. Tables and Scanned PDFs
To a computer, a scanned PDF is not text but a photo. It first has to go through text recognition (OCR) software, and that software can make mistakes on Turkish letters, especially ı, İ, ş, and ğ. Tables are a separate headache: a price table converted to text can turn into a pile of numbers that has lost its headers. Picking a few random pages from the archive and checking what the system reads from them is the cheapest quality check there is.
3. Old Documents Compete With New Ones
If the 2026 price list was added without deleting the 2025 one, both are equally relevant to the search engine. The assistant will quote the old price with the same confidence. The product sheet for a discontinued tracking device in our test carries this same risk. Each document's date and validity status should be stored as separate information, outdated documents should be removed from search, and the assistant should show the document's date in its answer.
4. Not Everyone Should See Every Document
If you gave the assistant the entire company archive, you also gave it the payroll tables and disciplinary records. An instruction like "don't tell anyone about these" is not an adequate security measure. The right approach is for the search to run, from the very start, only over documents the person asking has access to. An HR file should never show up in an accounting intern's search. Document permissions should be tied to the search layer, not to the assistant.
Does Every Business Need This?
No. If you have a few dozen documents and they rarely change, a well-organized folder and an FAQ page are often enough. If most questions are about live data, such as "has my invoice been paid?" or "how many units are in the warehouse?", what you need isn't document search; it's an assistant that can query your accounting or inventory system directly. And in fields like law or healthcare, where a wrong answer is costly, the assistant should show its source and a human should make the final call.
Whichever path you choose, you need to start not by picking a technology but by setting up a test. Collect 30-50 questions your employees actually ask, mark the correct document for each, and rerun this test after every change. The experiment in this post is a small example of that. Designing the search layer, permission controls, and this kind of measurement from the start for internal company assistants is at the heart of our AI integration work.
For developers: Turkish lowercasing and rank fusion
In Java, toLowerCase() works according to the server's default language, so the locale must be specified explicitly. With the Turkish locale, I is converted to ı and İ to i. For fusion, summing up the rank lists is enough:
static final Locale TR = Locale.forLanguageTag("tr");
static String normalize(String text) {
return text.toLowerCase(TR);
}
static Map<String, Double> fuse(List<List<String>> rankings, int k) {
Map<String, Double> scores = new HashMap<>();
for (List<String> ranking : rankings) {
for (int i = 0; i < ranking.size(); i++) {
scores.merge(ranking.get(i), 1.0 / (k + i + 1), Double::sum);
}
}
return scores;
}
If you use Elasticsearch, the built-in turkish analyzer includes filters that strip apostrophes, apply the Turkish lowercasing rule, and perform Turkish stemming. RRF is also built in; the rank_constant value defaults to 60. In program code, protocol keys, and HTML tags, however, you should use Locale.ROOT, not the Turkish locale; otherwise the word "TITLE" becomes "tıtle."
Sources
- P. Lewis et al., "Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks", NeurIPS 2020: arxiv.org/abs/2005.11401
- G. V. Cormack, C. L. A. Clarke, S. Büttcher, "Reciprocal Rank Fusion Outperforms Condorcet and Individual Rank Learning Methods", SIGIR 2009: doi.org/10.1145/1571941.1572114
- Anthropic, Contextual Retrieval, September 2024: anthropic.com/news/contextual-retrieval
- Unicode, SpecialCasing.txt (Turkish and Azerbaijani case mapping rules): unicode.org
- Snowball, Turkish stemming algorithm: snowballstem.org
- Java SE 21,
String.toLowerCase(Locale)documentation: docs.oracle.com
Note: The 36 documents and 20 questions in this post are synthetic; they do not belong to a real company. The figures in the table and animations were calculated with simple programs we wrote ourselves for this small example. Semantic (vector) search and reranking were not measured in this experiment; the figures on those topics come from Anthropic's published study, which used English data.
Cover photo: StartupStockPhotos / Pixabay