Problem with using the indicated grammatical form of a word in Polish

Hello. By no means can I figure out how to force the gpt-4 model to use keywords in the correct grammatical form in my content generator… i have a prompt:

"[article scheme…]

For the above article scheme, generate content for the following headline “|h2|What is the benefit of eating an apple every day?|/h2|” that does not include the

content in the above scheme. You should aim for the following SEO guidelines for all text from the above scheme.
“apples” ( in polish: “jabłek” ), “fruits” ( in polish: “owoce” ), “fruits” ( in polish: “owoców” ), “health”.

System prompt:
You play the role of a copywriter and SEO specialist, you know very well that if you are given a topic in which specific keywords are to be included then they must be used in exactly the same grammatical form in which they were placed in the requirements ( grammatical genus, grammatical number, grammatical case ), and if they are in a different grammatical form you can still use them, but you cannot embed them in the “|strong|” tag and include them in the quantity used for those specific words. In order to keep the natural sound of the text, you can use a word in a form other than the target form not embedded in the “|strong|” tag, and on this account, for example, lengthen the generated text using the keyword in the correct form in other places to meet the target requirements of the whole article

what is the problem? generated text fragment (from polish translate):
“[…] In addition, eating |strong|apples|strong| ( generated: “jabłek” which is incorrect… ) regularly can also improve our mental health. Studies show that people who eat a lot of |strong|fruits|/strong| ( generated: “owoców” which is correct ), including apples, have a lower risk of developing depression and other mental disorders. This is likely due to the presence of many nutrients in apples ( correct form not in |strong| tag…) that benefit brain function […]”

I have tried several ways to approach the problem, but I am just learning… any suggestions? Thanks…

Welcome to the community!
This one’s a toughie, but I live for questions and problems like these as someone who studied linguistics.
I’m not familiar with polish specifically, but I’m aware of the bare-bones basics of that language family. I’m aware it has and uses more cases than the English language, like instrumental case, correct?
First, which case did it generate incorrectly? Or rather, what about the generated words were wrong? And could you provide the pure un-translated polish response for me to analyze?
I’ll admit, your instructions confused me a bit myself. Also, when you are requesting specific formatting patterns and structure, examples within the system prompt (or any query really) and consistent reinforcement help the model tremendously.
Getting it to adhere to exact formats that are not simple or common can actually be quite difficult.

Below I give you the variation of the word “jabłko” by cases:
For the word “jabłko” in the singular:
Nominative (who? what?) - Jabłko
Complementary (whom? what?) - Jabłka
Purposive (to whom? why?) - Jabłku
Secondary (with whom? what?) - Jabłko
Adjective (with whom? with what?) - Jabłkiem
Locative (of whom? of what?) - Jabłku
Caller (of whom? what?) - Jabłko!
For the word “apples” in the plural:

Noun (who? what?) - Jabłka
Complementary (whom? what?) - Jabłek
Purposive (to whom? why?) - Jabłkom
Secondary (to whom? what?) - Jabłka
Adjective (with whom? with what?) - Jabłkami
Locative (of whom? of what?) - Jabłkach
Caller (of whom? what?) - Jabłka!

In general, what I mean is that a certain number of specific keywords with a certain grammatical form should be generated throughout the article. So that when I indicate in the prompt:
““Apples” 0/33, “apple”: 0/14, “Fruit” 0/12, “fruit”: 4/17, “Health”: 0/7”

This throughout the article so that in the tag ( html ) |strong| are generated these specific words in a certain amount.

I generate the entire article iteratively for each headline separately.

Below I send the complete prompt in Polish:
User monit:
Poniżej przedstawiam ci schemat:
|body|
|h1|Jabłka - właściwości zdrowotne. Ile mają kalorii?|/h1|
|p|Zgodnie z rekomendacjami Światowej Organizacji Zdrowia, owoce to produkty, które obok warzyw powinny
stanowić podstawę diety. Warto wybierać sezonowe owoce, a jesień bez wątpienia kojarzy się z soczystymi
jabłkami. Mają one niezwykle szerokie zastosowanie kulinarne, a oprócz tego stanowią cenne źródło wielu
substancji odżywczych. Dowiedz się, jakie korzyści wynikają ze spożywania jabłek.|/p|
|h2|Czy jabłka są zdrowe?|/h2|

           |h2|Co daje codzienne zjedzenie jabłka?|/h2|

           |h2|Jakie właściwości lecznicze mają jabłka?|/h2|

          |h2|Czy jabłka można jeść wieczorem?|/h2|

          |h2|Podsumowanie|/h2|

|/body|

Dla powyższego schematu artykułu wygeneruj treść do kolejnego nagłówka “|h2|Co daje codzienne zjedzenie jabłka?|/h2|” nie zawierającego treści |p| w powyższym schemacie. Powinieneś dążyć do uzyskania poniżej przedstawionych wytycznych SEO dla całego tekstu z powyższego.
“jabłka”:7/33, “owoce”: 2/14, “owoców”: 0/17, “zdrowie”: 0/7

Wygenerowany przez ciebie tekst zawiera obecnie: 894, a MASZ NAPISAĆ DOCELOWO: 10935 znaków.

System monit ( PL ):
Wcielasz się w rolę copywrittera i specjalistę SEO, dobrze wiesz, że jeżeli otrzymujesz temat w którym mają być uwzględnione konkretne słowa kluczowe to muszą być one wykorzystane w dokładnie takiej samej formie gramatycznej w jakiej zostały umieszczone w wymaganiach ( rodzaj gramatyczny, liczba gramatyczna, przypadek gramatyczny ), a jeśli są w innej formie gramatycznej nadal możesz ich używać, ale nie możesz ich osadzać w tagu “|strong|” oraz wliczać do wykorzystanych ilości tych konkretnych słów. Aby zachować naturalne brzmienie tekstu możesz użyć słowa w innej formie niż docelowa nieosadzonej w tagu “|strong|”, a na to konto np. wydłużyć generowany tekst wykorzystując słowo kluczowe w poprawnej formie w innych miejscach, aby spełnić docelowe wymagania całego artykułu.

ASSISTANT:
|h2|Czy |strong|jabłka|/strong| są zdrowe?|/h2|

|p||strong|Jabłka|/strong|, jak większość owoców, są niezwykle zdrowe. Są bogatym źródłem wielu witamin i minerałów, które są niezbędne dla naszego organizmu. W jednym średniej wielkości jabłku znajduje się około 4 gramy błonnika, co stanowi około 15% zalecanego dziennego spożycia. Błonnik jest niezbędny do utrzymania prawidłowej pracy układu pokarmowego i może pomóc w zapobieganiu wielu chorobom przewodu pokarmowego.

|p||strong|Jabłka|/strong| zawierają również dużą ilość witaminy C, która jest silnym antyoksydantem i pomaga chronić nasze ciało przed szkodliwym działaniem wolnych rodników. Witamina C jest również niezbędna do produkcji kolagenu, białka odpowiedzialnego za utrzymanie skóry, włosów i paznokci w dobrym stanie.|/p|

|p|Inne ważne składniki odżywcze zawarte w |strong|jabłkach|/strong| to potas, który pomaga kontrolować ciśnienie krwi; kwercetyna, związek roślinny o silnych właściwościach przeciwzapalnych i antyoksydacyjnych; oraz witamina K, która ma kluczowe znaczenie dla zdrowia kości i krwi.|/p|

|p|Wszystko to sprawia, że |strong|jabłka|/strong| są nie tylko smaczne, ale także bardzo zdrowe. Są doskonałym wyborem dla osób szukających zdrowych przekąsek czy dodatków do posiłków. A co więcej, są łatwo dostępne i stosunkowo tanie, co czyni je jednym z najbardziej popularnych owoców na świecie.|/p|

|p|Jednakże, jak w przypadku wszystkiego, kluczem jest umiar. Choć |strong|jabłka|/strong| są zdrowe, nie oznacza to, że powinniśmy jeść ich w nadmiarze. Jak każde owoce, jabłka zawierają cukry naturalne, które mogą przyczynić się do zwiększenia spożycia kalorii i ewentualnego przyrostu masy ciała jeśli spożywane w dużych ilościach. Dlatego ważne jest zrównoważone spożywanie owoców jako części zdrowej diety.|/p|

Summary:
I have bolded the errors in the generated text. As you can see, the word in the incorrect grammatical form is embedded in |strong| while some of the correct ones are not embedded in |strong|. Embed in |strong| I told him to see if he understands how to count keywords.

In the next prompt, I would recalculate the keywords used in exact grammatical form, similarly the number of characters used, and pass the next header to generate. Taking into account the generated text from the previous iteration in the monit.

I think I see what you’re trying to do now. Thank you for providing this!
It does appear you give it proper examples, or close enough examples.

Question for you: Are you open to post-processing the generated responses through scripting/code, or perhaps adding a scripting layer to this workflow?

I think you’re bumping into some of the limitations that these models currently have right now. Specifically, these models process language via tokens, which is not direct grammaticality. This means that if your keywords (and grammatical changes to those keywords) have different constructions token-wise, it is likely to fail at successfully counting those keywords without performing a script-based check via Advanced Data Analysis plugin (or your own scripts). It’s unintuitive for us, and no direct/obvious mapping into how tokens translate to the words and grammar we typically associate with language. Also, this:

Wygenerowany przez ciebie tekst zawiera obecnie: 894, a MASZ NAPISAĆ DOCELOWO: 10935 znaków.

Translated into English (in case others want to follow along) means roughly this, right?

The text generated by you currently contains 894 characters, and you are to ultimately write 10,935 characters.

This is extremely difficult for an AI to do accurately because of the aforementioned token issue. This would need to be iteratively assessed, and likely with the aid of scripting to count and verify this.

The good news is that GPT should still be able to generate the raw text for what you want. Your iterative approach is also good; you just need to tweak how to ask for the content you’re looking for and how to optimize the generated text for SEO.

I would recommend looking into scaffolding more in the context of content generation. Templatizing this will be helpful for you and the AI.

For each section you’re trying to generate, formulate a prompt that not only describes the kind of content that needs to be generated but also specifies the keywords, their grammatical forms, and the number of times these grammatical forms should appear. For example:

Generate content for the section titled “Benefits of Eating Apples” for an article about healthy eating. Please include the word “jabłek” in its nominative form 3 times and in its complementary form 2 times.

Below should be an overview on how to best approach this problem in polish. I did use GPT to help with that translation, so if there’s anything confusing or something doesn’t make sense, please let me know. If you need clarification, or more details or guidance in other areas, I’m happy to help you with this!

I hope this helps!


Zmodyfikowane podejście iteracyjne

Oto krok po kroku:

  1. Zdefiniuj Sekcje: Zanim zaczniesz, zidentyfikuj sekcje, które będą tworzyć cały artykuł. Mogą one być oparte na wcześniej zdefiniowanym zarysie lub szkielecie.
  2. Sformułuj Monity: Dla każdej sekcji sformułuj monit, który nie tylko opisuje rodzaj treści, który ma być wygenerowany, ale także określa słowa kluczowe, ich formy gramatyczne i liczbę razy, w których powinny się pojawić. Na przykład:

bashCopy code

Wygeneruj treść dla sekcji zatytułowanej "Korzyści z jedzenia jabłek" do artykułu o zdrowym odżywianiu. Proszę uwzględnić słowo "jabłek" w formie mianownika 3 razy i w formie dopełniacza 2 razy.
  1. Generuj Tekst: Użyj sformułowanego monitu, aby wygenerować tekst dla każdej sekcji. Ponieważ jest to robione iteracyjnie, każda wygenerowana sekcja może być zapisana osobno.
  2. Przejrzyj i przetwórz: Po wygenerowaniu każdej sekcji użytkownik może zastosować skrypt do post-processingu, aby sprawdzić liczbę słów kluczowych i dodać tagi HTML w razie potrzeby. Jeżeli sekcja nie spełnia kryteriów, można ją albo ręcznie edytować, albo wygenerować ponownie z nowym monitem.
  3. Agreguj Sekcje: Po wygenerowaniu i przetworzeniu wszystkich sekcji można je agregować, aby utworzyć kompletny artykuł.
  4. Ostateczna recenzja: Przeprowadź ostateczną recenzję, aby upewnić się, że cały artykuł spełnia wszystkie określone wymagania, w tym ogólną liczbę znaków, jeśli jest to ograniczenie.
  5. Aktualizacja Następnego Monitu: Jeśli cele dotyczące słów kluczowych lub inne ograniczenia nie są spełnione w jednej iteracji, następny monit można dostosować, aby to skompensować. Na przykład, jeśli forma mianownika “jabłek” została użyta tylko dwa razy zamiast trzech w pierwszej sekcji, monit dla drugiej sekcji może określić, że musi być użyta dodatkowy raz.

Stosując to zmodyfikowane podejście iteracyjne, użytkownik może wygenerować artykuł, który spełnia jego złożone wymagania związane z SEO, dokładnością gramatyczną i formatowaniem.

1 Like

Thanks! Due to the time, I will analyze it tomorrow and will definitely come back here with any concerns. But I already see a lot of knowledge to analyze.

1 Like

Personally, I think the model “sees” 2 cases of the same word being presented as separate items in the task and starts paying attention to the case of a noun more than it should.

I would try to rethink your prompt, especially considering Google doesn’t really care which case of noun is used as long as the language rules are respected, to make the tasks shorter, better structured and easier to follow.

For example instead of asking writing content for the section, ask to give some ideas for the section, transform ideas into plan, then list phrases accordingly to plan, then arrange them into final draft and finally adjust the language…