| 22 | | See the LICENSE file in the same directory for licensing details. |
| | 22 | |
| | 23 | === Example Usage |
| | 24 | |
| | 25 | require 'linkparser' |
| | 26 | |
| | 27 | dict = LinkParser::Dictionary.new( :screen_width => 100 ) |
| | 28 | sent = dict.parse( "People use Ruby for all kinds of nifty things." ) |
| | 29 | # => #<LinkParser::Sentence:0xcf8eb "LEFT-WALL people use Ruby for all kinds |
| | 30 | # of nifty things . RIGHT-WALL"/2 linkages/0 nulls> |
| | 31 | |
| | 32 | sent.subject # => "people" |
| | 33 | sent.verb # => "use" |
| | 34 | sent.object # => "Ruby" |
| | 35 | |
| | 36 | puts sent.constituent_tree_string |
| | 37 | # => |
| | 38 | # (S (NP People) |
| | 39 | # (VP use |
| | 40 | # (NP Ruby) |
| | 41 | # (PP for |
| | 42 | # (NP (NP all kinds) |
| | 43 | # (PP of |
| | 44 | # (NP nifty things))))) |
| | 45 | # .) |
| | 46 | |
| | 47 | puts sent.diagram |
| | 48 | # => |
| | 49 | # +-------------------------------Xp------------------------------+ |
| | 50 | # | +----MVp---+----Jp----+ +------Jp-----+ | |
| | 51 | # +----Wd---+--Sp--+--Os-+ | +-Dmc-+--Mp-+ +----A---+ | |
| | 52 | # | | | | | | | | | | | |
| | 53 | # LEFT-WALL people.p use.v Ruby for.p all kinds.n of nifty.a things.n . |
| | 54 | |
| | 55 | |
| | 56 | == Legal |
| | 57 | |
| | 58 | For copyright and licensing information for link-grammar itself, see the |
| | 59 | LICENSE file in that distribution. |
| | 60 | |
| | 61 | Copyright (c) 2006-2008, Michael Granger |
| | 62 | All rights reserved. |
| | 63 | |
| | 64 | Redistribution and use in source and binary forms, with or without |
| | 65 | modification, are permitted provided that the following conditions are met: |
| | 66 | |
| | 67 | * Redistributions of source code must retain the above copyright notice, |
| | 68 | this list of conditions and the following disclaimer. |
| | 69 | |
| | 70 | * Redistributions in binary form must reproduce the above copyright notice, |
| | 71 | this list of conditions and the following disclaimer in the documentation |
| | 72 | and/or other materials provided with the distribution. |
| | 73 | |
| | 74 | * Neither the name of the author/s, nor the names of the project's |
| | 75 | contributors may be used to endorse or promote products derived from this |
| | 76 | software without specific prior written permission. |
| | 77 | |
| | 78 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| | 79 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| | 80 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| | 81 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE |
| | 82 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| | 83 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| | 84 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| | 85 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| | 86 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| | 87 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| | 88 | |
| | 89 | |
| | 90 | $Id$ |
| | 91 | |
| | 92 | |