NLP: Extract shape names and shape dimensions












2















I am an NLP beginner. I am working on a task where I have to process a text to draw shapes.



I did some research and found that tokensregex could be a good fit.



For example



Text : Could you please draw an Isosceles triangle with an altitude of 150 and a base of 100.



In here, my approach is to write tokensregex rule to extract shape name and dimensions. Once i get these two data, I will draw the extracted shape with the given dimensions.



Is my choice of using tokensregex correct?



Or is there any other way to do it smartly?










share|improve this question



























    2















    I am an NLP beginner. I am working on a task where I have to process a text to draw shapes.



    I did some research and found that tokensregex could be a good fit.



    For example



    Text : Could you please draw an Isosceles triangle with an altitude of 150 and a base of 100.



    In here, my approach is to write tokensregex rule to extract shape name and dimensions. Once i get these two data, I will draw the extracted shape with the given dimensions.



    Is my choice of using tokensregex correct?



    Or is there any other way to do it smartly?










    share|improve this question

























      2












      2








      2








      I am an NLP beginner. I am working on a task where I have to process a text to draw shapes.



      I did some research and found that tokensregex could be a good fit.



      For example



      Text : Could you please draw an Isosceles triangle with an altitude of 150 and a base of 100.



      In here, my approach is to write tokensregex rule to extract shape name and dimensions. Once i get these two data, I will draw the extracted shape with the given dimensions.



      Is my choice of using tokensregex correct?



      Or is there any other way to do it smartly?










      share|improve this question














      I am an NLP beginner. I am working on a task where I have to process a text to draw shapes.



      I did some research and found that tokensregex could be a good fit.



      For example



      Text : Could you please draw an Isosceles triangle with an altitude of 150 and a base of 100.



      In here, my approach is to write tokensregex rule to extract shape name and dimensions. Once i get these two data, I will draw the extracted shape with the given dimensions.



      Is my choice of using tokensregex correct?



      Or is there any other way to do it smartly?







      c# nlp






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 26 '18 at 5:36









      MARKAND BhattMARKAND Bhatt

      83742354




      83742354
























          2 Answers
          2






          active

          oldest

          votes


















          2














          Given the well defined boundaries of your problem, Tokensregex could be the right way to go. You might spend some time maturing it. But it should be the preferred way. But before you finalise your approach I suggest you pitch it against some deep parsing technique. Here is what you could get that you might be able to combine with some dictionary of known shapes and write extraction logic.



           (ROOT
          (SQ (MD Could)
          (NP (PRP you))
          (VP (VB please)
          (VP (VB draw)
          (NP (DT an) (NNP Isosceles) (NN triangle))
          (PP (IN with)
          (NP
          (NP
          (NP (DT an) (NN altitude))
          (PP (IN of)
          (NP (CD 150))))
          (CC and)
          (NP
          (NP (DT a) (NN base))
          (PP (IN of)
          (NP (CD 100))))))))
          (. .)))


          Here, you are getting readymade chunks of altitude - 150 and base - 100. See if this helps.






          share|improve this answer































            1














            There is no right way to do what you are asking. If all your sentences are as on the example, then the rule-based approach with dependency parsing seems like a solution where rules identify attributes and values and dependency parsing identifies relations between them.



            More formally, semantic parsing should help in this case






            share|improve this answer























              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53475256%2fnlp-extract-shape-names-and-shape-dimensions%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              2














              Given the well defined boundaries of your problem, Tokensregex could be the right way to go. You might spend some time maturing it. But it should be the preferred way. But before you finalise your approach I suggest you pitch it against some deep parsing technique. Here is what you could get that you might be able to combine with some dictionary of known shapes and write extraction logic.



               (ROOT
              (SQ (MD Could)
              (NP (PRP you))
              (VP (VB please)
              (VP (VB draw)
              (NP (DT an) (NNP Isosceles) (NN triangle))
              (PP (IN with)
              (NP
              (NP
              (NP (DT an) (NN altitude))
              (PP (IN of)
              (NP (CD 150))))
              (CC and)
              (NP
              (NP (DT a) (NN base))
              (PP (IN of)
              (NP (CD 100))))))))
              (. .)))


              Here, you are getting readymade chunks of altitude - 150 and base - 100. See if this helps.






              share|improve this answer




























                2














                Given the well defined boundaries of your problem, Tokensregex could be the right way to go. You might spend some time maturing it. But it should be the preferred way. But before you finalise your approach I suggest you pitch it against some deep parsing technique. Here is what you could get that you might be able to combine with some dictionary of known shapes and write extraction logic.



                 (ROOT
                (SQ (MD Could)
                (NP (PRP you))
                (VP (VB please)
                (VP (VB draw)
                (NP (DT an) (NNP Isosceles) (NN triangle))
                (PP (IN with)
                (NP
                (NP
                (NP (DT an) (NN altitude))
                (PP (IN of)
                (NP (CD 150))))
                (CC and)
                (NP
                (NP (DT a) (NN base))
                (PP (IN of)
                (NP (CD 100))))))))
                (. .)))


                Here, you are getting readymade chunks of altitude - 150 and base - 100. See if this helps.






                share|improve this answer


























                  2












                  2








                  2







                  Given the well defined boundaries of your problem, Tokensregex could be the right way to go. You might spend some time maturing it. But it should be the preferred way. But before you finalise your approach I suggest you pitch it against some deep parsing technique. Here is what you could get that you might be able to combine with some dictionary of known shapes and write extraction logic.



                   (ROOT
                  (SQ (MD Could)
                  (NP (PRP you))
                  (VP (VB please)
                  (VP (VB draw)
                  (NP (DT an) (NNP Isosceles) (NN triangle))
                  (PP (IN with)
                  (NP
                  (NP
                  (NP (DT an) (NN altitude))
                  (PP (IN of)
                  (NP (CD 150))))
                  (CC and)
                  (NP
                  (NP (DT a) (NN base))
                  (PP (IN of)
                  (NP (CD 100))))))))
                  (. .)))


                  Here, you are getting readymade chunks of altitude - 150 and base - 100. See if this helps.






                  share|improve this answer













                  Given the well defined boundaries of your problem, Tokensregex could be the right way to go. You might spend some time maturing it. But it should be the preferred way. But before you finalise your approach I suggest you pitch it against some deep parsing technique. Here is what you could get that you might be able to combine with some dictionary of known shapes and write extraction logic.



                   (ROOT
                  (SQ (MD Could)
                  (NP (PRP you))
                  (VP (VB please)
                  (VP (VB draw)
                  (NP (DT an) (NNP Isosceles) (NN triangle))
                  (PP (IN with)
                  (NP
                  (NP
                  (NP (DT an) (NN altitude))
                  (PP (IN of)
                  (NP (CD 150))))
                  (CC and)
                  (NP
                  (NP (DT a) (NN base))
                  (PP (IN of)
                  (NP (CD 100))))))))
                  (. .)))


                  Here, you are getting readymade chunks of altitude - 150 and base - 100. See if this helps.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 26 '18 at 7:48









                  rishirishi

                  1,15831841




                  1,15831841

























                      1














                      There is no right way to do what you are asking. If all your sentences are as on the example, then the rule-based approach with dependency parsing seems like a solution where rules identify attributes and values and dependency parsing identifies relations between them.



                      More formally, semantic parsing should help in this case






                      share|improve this answer




























                        1














                        There is no right way to do what you are asking. If all your sentences are as on the example, then the rule-based approach with dependency parsing seems like a solution where rules identify attributes and values and dependency parsing identifies relations between them.



                        More formally, semantic parsing should help in this case






                        share|improve this answer


























                          1












                          1








                          1







                          There is no right way to do what you are asking. If all your sentences are as on the example, then the rule-based approach with dependency parsing seems like a solution where rules identify attributes and values and dependency parsing identifies relations between them.



                          More formally, semantic parsing should help in this case






                          share|improve this answer













                          There is no right way to do what you are asking. If all your sentences are as on the example, then the rule-based approach with dependency parsing seems like a solution where rules identify attributes and values and dependency parsing identifies relations between them.



                          More formally, semantic parsing should help in this case







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 26 '18 at 7:51









                          comcom

                          1,17131532




                          1,17131532






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53475256%2fnlp-extract-shape-names-and-shape-dimensions%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Create new schema in PostgreSQL using DBeaver

                              Deepest pit of an array with Javascript: test on Codility

                              Costa Masnaga