How to make an expert system

    General discussion

  • Hi, i am a beginer of C# and i was thinking to create a system which would add the data as the user enters it

    for eg: a general store software, first time user made an entry of Tissue paper ,next time if first term is similar to "t" for tissue box automatically any tool(what u'll prefer) will pops up and show the option of tissue box to select

    please reply asap

    (sorry for my bad english)


    Wednesday, June 29, 2011 1:37 PM

All replies

  • So, from a structure point of view, I'd have a few pieces. (This is a simplified approach)

    1. SQL Server (or some kind of data storage, maybe a CSV file, or XML, or anything)

    2. A manager program which allows the creation of new item records, and the ability to edit existing ones.

    3. An Item class which represents an item. Purchase price, sale price, SKU, quantity in stock, name, description, that sort of thing.

    4. An ItemSearcher class which the input would be a few letters from a query (the 't' part) and the output would be a List<Item> ranked by similarity. The class would do a query on the database something like select * from items where name like @firstLetters + '%' order by name.


    So you'd use this in a Windows Form or with AJAX on an ASP.NET site to call out to the ItemSearcher class every time the user adds a letter. When the method would return, you'd just show a ContextMenu or something to display the item list.

    Wednesday, June 29, 2011 3:44 PM
  • Really thanks for the help

    but i need little bit more explanation and i plan to make it in winforms

    Wednesday, June 29, 2011 6:52 PM
  • I think what you are getting towards, is an Auto complete(ion) box.

    The concept you are trying to use is that, you want to remember anything that is newly entered, which your system doesnt know. Well, that itself answers the question in a way.

    Lets check this question: What does my system know? Or how can we supply it a brain to keep track of things it knows?

    The answer would be to implement some sort of data in a storage.

    Like Barrakoda said, you might use a sql server, or a program that manages the data, or an item(commonly a collection) class.

    For test purposes, instead of using a database, lets use a list, to store all the worsd the system knows.

    Now your next task is to get user input, and then check which of the systems data matches with it.

    So, upon your text changed event,

    1) get the data in the textbox

    2) loop through your list, check the first letters to match up with the first letters of each of the list elements (if you want to goto an advanced level, use Pattern class)

    3) get the matched elements into a new list and display this new list.

    4) when the text again changes

    a) for beginner purposes, lets assume a new character is added and no character is deleted), instead of using the system's initial data list, use the newly gotten list from step 3 (so, that you will just have to loop through lesser entries).

    b) If you wanna work in an advanced way, where a character deletion is also taken into account, you can go for the entire initial list


    Hope it helps.

    Wednesday, June 29, 2011 9:43 PM