Handwritten Text Recognition for manuscripts and early printed texts
AI Builder - Text Classification
1. Text classification
Textclassificationtagsanysnippetof textbasedonthe historical datayouprovide. Thisallowsyouto
streamline yourbusinessbyautomaticallytaggingnew text.
In thislab,we will buildandtraina textclassificationmodel. We will thenuse the Predictactionto
analyze textandthentake actionbasedon the results.
Note: If you are buildingthe firstmodel inanenvironment,clickonExplore Templatestogetstarted.
Exercise 1 – Build the text classification model
1. From the leftnavigation,expandAIBuilderandselectBuild. SelectTextClassification.
2. Name yourmodel. Because youare workingina sharedenvironmentmake sure toinclude your
name as part of the model name. Thiswill make iteasiertofindlater.ClickCreate.
3. 5. SelectTextforthe field. ClickSelectfield. Thisidentifiesthe datathatwill be analyzed.
6. Reviewapreviewof the datathat will be classified. Clicknext.
7. Nowwe will selecttags. ClickSelectTags.
5. 11. SelectEnglish andclickNext.
12. Confirmthe configurationandselectTrain.
13. Locate and openyourmodel. If youneedhelpfindingit,type yourname intothe searchbox.
6. 14. Reviewthe performanceof the model. SelectQuicktest.
15. Here we can testand validate ourmodel.Addthe followingtexttoclassify: The doctorsand
nursestookcare of me well duringmystay.
7. 16. ClickTestand reviewthe classification. Close the testdialog.
17. Nowyou can testany text. Testthe following: The weatherinAtlantaisgreat!
Close the testdialog.
18. Publishyourmodel.
8. Exercise 2- Use the model from Microsoft Flow
Once the model hasbeentrainedyoucan use the model fromMicrosoftFlow. Thisallowsyouto
leverage textclassificationinthe automationyoubuild. Inthisexercise,we will focusonhow touse the
Predictactionto analyze textandthentake actionbasedon the results.
Task 1 -Create a flow
1. Navigate tohttps://flow.microsoft.com ;signinif necessary.
2. Confirmthe environmentinthe upperrightcorneristhe one you have beenassignedforthe
lab.
3. SelectMy Flowsinthe leftnavigation.
4. Clickon Import.
9. 5. Uploadthe .zipfile namesProcessFeedback_Flow.zipthathasbeenprovided forthisworkshop.
6. Once the package detailsare displayed,clickonthe tool iconnexttothe CommonData Service
(currentEnvironment) Connection.
10. 7. Clickon Create NewConnection.
8. Once you land on the connectionsscreen,clickonCreate New Connection.
13. 11. Once the connectionhasbeensuccessfullycreated,return tothe ImportPackage screen.You
shouldnowsee yournewlycreatedconnectiononthe right.Clickrefreshif not.
12. Once done clickon Import.
14. 13. Once completedthe import,Openthe Flow.
Task 2 – Invoke Predict and Parse the output
1. Expandthe Predictactionand on the Model dropdown locate andselectyourmodel youbuiltin
the previousexercise.
15. 2. The RequestPayloadwaspre-configuredand shouldlooklike the following. Whatyouare
doinghere isprovidingthe inputtothe Predictactionandconnectingitto the textyouwill input
whenthe flowisrun.
3. Next,because the Predictactioncanworkwithdifferenttypesof models,the outputcan
containdifferentdata. So future stepscaneasilyuse the output.We are goingto use a Parse
JSON actionthat will parse the outputandmake it available tosubsequentstepswithknown
names.
4. Click+ NewStepand type Parse JSON inthe search field.
5. Selectthe Parse JSON action.
16. 6. Clickinthe Contentfieldand selectResponse Payloadfromthe Dynamiccontentpanel.
7. Nextclickinthe Schemafieldandpaste inthe following. Thisisa schemathat tellsthe parse
actionwhat to expectinthe content. Youwill be able tofindthisinthe docs site inthe future.
{
"type":"object",
"properties":{
"predictionOutput":{
"type":"object",
"properties":{
"results":{
"type":"array",
"items":{
"type":"object",
18. Task 3 Process the output
In thistaskwe are goingto take the outputanduse itto email the differentdepartments. The Predict
mightclassifymultiple tagmatches,eachreturnedwithatype anda score. We onlywant to senda
copy of the feedbacktothe departmentswhenthe score isgreaterthan63. To accomplishthis,we will
add a conditionactionandcheckthe score and the type.For eachone that passesthe criteriaand we
will sendanemail.
1. Click+ NewStepand searchfor Condition.
2. Selectthe Filterarrayaction.
3. Clickinthe Choose a value fieldand selecttype fromthe Dynamiccontentpanel.
19. 4. Because there couldbe multipletype andscore recordsreturned,flow will wrapyourcondition
inan Applyforeach actionand it shouldnow looklike the following
5. Clickon the Conditionactiontoexpandit.
6. Clickinthe secondChoose a value fieldtype Staff.
20. 7. Click+ Add andthen+ AddRow to adda secondcheckinthe conditionfortype.
8. Clickinthe Choose a value field,andselectscore inthe Dynamiccontentpane.
9. Change the operatorto isgreaterthan and type 0.63 inthe secondvalue field.
21. Double check that the value is 0.63 and not.63 otherwisethe flowwill fail.
10. Inside the If Yespath of the condition,clickAddanaction
11. Searchon Sendan Email.
12. SelectSendan email (v2).
13. In the To fieldtype yourlabuser.
14. In the subjecttype Staff Feedback.
15. Clickinthe body andselectFeedbackinthe Dynamiccontentpanel.
22. 16. ClickTestand thenchoose I’ll performthe actionandthenclickSave and Test.
17. In the feedbackpaste the following:
The doctors were veryprofessional,nurseswere kindandattentive,the roomwasnice butthe
foodat the cafeteriaandin roomis terrible
18. ClickRunFlow.
19. Your flowshouldrunsuccessfullyandshouldlooksomethinglikethe following. Youshouldalso
nowhave an email with the feedback.