| Windows Live Ag... 的个人资料Windows Live Agents照片日志列表 | 帮助 |
|
6月27日 Best Practices for Developing a Windows Live Agent: part 2Create Good Subpatterns Subpatterns are one of the most powerful NL recognition features in the BuddyScript language. They allow you to write efficient, reusable code. Many subpatterns are defined in various packages in the Vocabulary directories for each language in BuddyScriptLib. Have a look at the subpatterns created there before you create your own. Many general parts-of-speech and “chat” subpatterns, as well as subpatterns for industry-specific terminology, are defined there. Create subpatterns for anything else you foresee your end users chatting about – product names, peoples’ names, place names, etc. NL-brick Subpatterns When you define a subpattern as an NL-brick, every element of the subpattern that is recognized at maximum strength is a candidate to replace sections of your NL handles. This is a very useful property, but use it carefully. If you want only certain elements to replace the natural language in an NL-brick subpattern, make the other elements score lower. Define subpatterns as NL-bricks by putting them within NL-brick zones. If your project is derived from the WLATemplate, add NL-bricks in “YourAgent/YourLanguage/CustomSubpatterns.pkg,” which already contains an NL-brick zone. Example: begin properties SubpatternsAreNLBricks // Start of NL brick zone … ### “n” prefix: Noun Stems subpattern nMotorcycle subpattern nsMotorcycle + (=nMotorcycle|=nMotorbike) + =nBike {score=MACRO_ MEDIUM_SCORE} … end properties SubpatternsAreNLBricks // End of NL brick zone In the above example, the word “motorcycles” in the natural language handle “? How much do motorcycles cost?” will be replaced by = nsMotorcycle, but the word “bike” in the natural language handle “? Can I ride my bike to work?” will not be replaced by =nsMotorcycle as “bike” does not match at maximum strength in the subpattern. Therefore, if the user types “How much do bikes cost?” it will match on “? How much do motorcycles cost?” (albeit with a lower score), but if the user types “Can I ride my motorcycle to work?” it will not match on “? Can I ride my bike to work?” Example: begin properties SubpatternsAreNLBricks subpattern nsNewYorkCity + (new york [city]|manhattan) + nyc {spellcorrect=no} return “New York City” end properties SubpatternsAreNLBricks
subpattern ACity + CITY=NewYorkCity + CITY=SanFrancisco + CITY=Chicago return CITY In the above example, the =ACity subpattern should not be an NL-brick because you would not want “New York City” in a natural language handle such as “? What are some good restaurants in New York City?” to be replaced by =ACity (if it were, the user query “What are some good restaurants in Chicago?” would match on “? What are some good restaurants in New York City?”) In general, specifying some subpatterns as NL-bricks and leaving others as non-NL-bricks (the default behavior) allows you great control over how subpatterns are used in your matching. Binding Subpatterns to Variables Bind subpatterns to variables whenever you need to use the value returned by a subpattern, either as a parameter in a data request, to store interesting user data, or simply to make the agent’s response “smarter.” Example: - Where do you live? ? I live in CITY=ACity ? CITY=ACity STATE = GetStateForCity(CITY) USER_LOCATION = CITY - Wow! I love CITY! That’s in the state of STATE, right? User: I live in nyc Agent: Wow! I love New York City! That’s in the state of New York, right? 6月22日 Best Practices for Developing a Windows Live Agent: Part 1Today we will start a series on best practices for developing a Windows Live Agent (WLA). Here we go:
Use the WLATemplate Project as a Starting Point
The WLATemplate Project (“C:\Program Files\Colloquis\Colloquis SDK\Projects\WLATemplate“) is a generic project you can quickly customize into your own Agent. Simply launch the instantiation script “StartInstantiation.bat” and follow the instructions to start a new Agent in the right directory. Use Natural Language Handles The fastest and most efficient way to get your Agent to recognize User questions is to add Natural Language Handles. NL Handles are analyzed against the libraries of rephrase rules and synonym subpatterns defined in your project and in the BuddyScriptLib packages (included in the SDK) and are transformed into regular “+” style matching patterns. Example: This natural language handle: ? What can you do? is rephrased as: ? What do you do? and “patternized” into these subpatterns: + =qsWhat =vDo =You =vDo This user query: Tell me what you do is rephrased as: What do you do? Case and punctuation are stripped from queries, so: what do you do matches perfectly on the patternized natural language in the agent. Natural language handles should be:
6月19日 WelcomeWelcome to the Windows Live Agents Team blog!
This blog will be used to post announcements, tips, and documentation supplements to help planning, development, deployment, and support of your agent. Our SDK is currently in an Alpha release stage, accessible by only a very small audience. Please look out for a public beta coming later this year! This blog and other community resources should help to prepare and give you a very rough idea of some features even before you have full access to the SDK.
Comments are always welcome, but to effectively engage the community and product group in discussion, please post your questions to our forum found at: http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=1687&SiteID=1 |
|
|