<p>If I understand the question correctly you are looking for a semantic parser for Swedish which translates natural language sentences into SQL queries suites for your product. This task is very big and can be a huge project. If you are looking for a quick solution jump to the last paragraph.</p>

<p>The good old standard way in computational semantics is to write a syntax for the parser and the translation of each word into your database. e.g. There are examples in <a href="http://www.nltk.org/book/ch10.html" rel="nofollow noreferrer">this NLTK package</a>.</p>

<p>The challenge for such path is that you need to manually hard code all possible vocabulary in a single syntax file. A more advanced similar solution is to use <a href="http://www.grammaticalframework.org/" rel="nofollow noreferrer">Grammatical Framework</a> and write you controlled language in GF. There you can start from their large resource grammar and you don't need to worry about the grammar of different languages. This will be a package that you can add to your python program or something like that. </p>

<p>If those solutions for controlled languages don't serve you well, there are other options such as probabilistic CCG parser translating the natural language to SQL (e.g. <a href="https://github.com/workday/upshot-montague/" rel="nofollow noreferrer">English-to-SQL</a> and <a href="https://arxiv.org/pdf/1704.08760.pdf" rel="nofollow noreferrer">other ideas</a>), which you probably need to train it on your own. And, if you have a lot of annotated data and you want to have the state of the art technology maybe you can take a look at parsers using neural machine translator, e.g. <a href="https://github.com/mokemokechicken/keras_npi" rel="nofollow noreferrer">neural programmer</a>.</p>

<p>Finally, if you want to have a fast solution write regular expressions for patterns that you know. The outcome might become still very similar to <a href="https://www.wolframalpha.com/" rel="nofollow noreferrer">WolframAlpha</a> queries. You can even make some of these regular expressions dynamic based on known name entities in your database. Hopefully, this answers your question.</p>
Swedish NLP for product search engine with structured data
<p>I’m currently working on a project in which I have a database with 1000 products (washing machines), where each one has 21 product attributes (such as weight, dimensions, colour, power consumption and so on.)
My aim to use NLP to make the users able to search the database of products by queries of natural language, like:</p>
<blockquote>
<p>“Find a washing machine that can load at least 8 kg of laundry, and with height no more than 60 cm and with a front of stainless steel”</p>
<p>“I’m looking for a washing machine that costs less than 6000 SEK and has the opening in the front, not in the top”</p>
</blockquote>
<p>This NL query needs to be translated to a SQL-query to be used with my database. The problem is that I would need it to work in the Swedish language.
I’ve found a great API (<a href="https://json-tagger.com/" rel="nofollow noreferrer">https://json-tagger.com/</a>) that does the pre-processing of the sentences for me, tokenization and tagging Part of speech in Swedish. Thanks! But now I would really like some tips on how I best use this to translate it to SQL-queries?</p>
<p>I guess I would need to extract the relations and semantics of the user input in order to query the database, but I’m not sure how to do this. As it is a fairly limited area (washing machine product search) I hope I can construct some rules for doing this, but I’m not sure if that is the right way to go. Any help or ideas are very appreciated! :)</p>
<p>I kind of new to NLP and would really prefer working in Python3. Thank you!</p>