diff --git a/DeterministicGenerator.py b/DeterministicGenerator.py index a6f526c..8479736 100644 --- a/DeterministicGenerator.py +++ b/DeterministicGenerator.py @@ -1,3 +1,26 @@ +# -*- coding: utf-8 -*- +# @copyright: MIT License +# Copyright (c) 2018 syntactic (Pastèque Ho) +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# @summary: This file generates all strings described by a non-recursive JSGF grammar. +# Run it by entering into the command line: python DeterministicGenerator.py +# where is the path to the JSGF grammar. +# @since: 2014/06/02 + """ This file deterministically generates strings from a JSGF Grammar, whether there are \ weights defined in rules or not. It requires one argument: the path to the JSGF\ @@ -13,31 +36,6 @@ a segmentation fault. """ -# @copyright: (c)Copyright 2014, THC All Rights Reserved. -# The source code contained or described here in and all documents related -# to the source code ("Material") are owned by THC or its -# suppliers or licensors. Title to the Material remains with THC -# or its suppliers and licensors. The Material contains trade secrets and -# proprietary and confidential information of THC or its suppliers and -# licensors. - -# The Material is protected by worldwide copyright and trade secret laws and -# treaty provisions. No part of the Material may be used, copied, reproduced, -# modified, published, uploaded, posted, transmitted, distributed, or disclosed -# in any way without THC's prior express written permission. - -# No license under any patent, copyright, trade secret or other intellectual -# property right is granted to or conferred upon you by disclosure or delivery -# of the Materials, either expressly, by implication, inducement, estoppel or -# otherwise. Any license under such intellectual property rights must be express -# and approved by THC in writing. - -# @organization: THC Science -# @summary: This file generates all strings described by a non-recursive JSGF grammar. -# Run it by entering into the command line: python DeterministicGenerator.py -# where is the path to the JSGF grammar. -# @since: 2014/06/02 - import sys, itertools import JSGFParser as parser import JSGFGrammar as gram diff --git a/JSGFGrammar.py b/JSGFGrammar.py index 26e4a92..628d79f 100644 --- a/JSGFGrammar.py +++ b/JSGFGrammar.py @@ -1,32 +1,32 @@ +# -*- coding: utf-8 -*- +# @copyright: MIT License +# Copyright (c) 2018 syntactic (Pastèque Ho) +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# @summary: This file lays out the class structure for a JSGF Grammar +# @since: 2014/06/02 + """ This file lays out the class structure for a JSGF Grammar. .. module:: JSGFGrammar -.. moduleauthor:: Timothy Ho +.. moduleauthor:: Pastèque Ho """ -# @copyright: (c)Copyright 2014, THC All Rights Reserved. -# The source code contained or described here in and all documents related -# to the source code ("Material") are owned by THC or its -# suppliers or licensors. Title to the Material remains with THC -# or its suppliers and licensors. The Material contains trade secrets and -# proprietary and confidential information of THC or its suppliers and -# licensors. - -# The Material is protected by worldwide copyright and trade secret laws and -# treaty provisions. No part of the Material may be used, copied, reproduced, -# modified, published, uploaded, posted, transmitted, distributed, or disclosed -# in any way without THC's prior express written permission. - -# No license under any patent, copyright, trade secret or other intellectual -# property right is granted to or conferred upon you by disclosure or delivery -# of the Materials, either expressly, by implication, inducement, estoppel or -# otherwise. Any license under such intellectual property rights must be express -# and approved by THC in writing. - -# @organization: THC Science -# @summary: This file lays out the class structure for a JSGF Grammar -# @since: 2014/06/02 + class JSGFExpression(): pass diff --git a/JSGFParser.py b/JSGFParser.py index a63f86e..7bb06cc 100644 --- a/JSGFParser.py +++ b/JSGFParser.py @@ -1,3 +1,24 @@ +# -*- coding: utf-8 -*- +# @copyright: MIT License +# Copyright (c) 2018 syntactic (Pastèque Ho) +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# @summary: This file parses a JSGF Grammar and prints it out. +# @since: 2014/06/02 + """ This file parses a JSGF grammar file and returns a JSGFGrammar object. \ It uses the pyparsing module and defines a grammar for JSGF grammars. \ @@ -37,29 +58,6 @@ """ -# @copyright: (c)Copyright 2014, THC All Rights Reserved. -# The source code contained or described here in and all documents related -# to the source code ("Material") are owned by THC or its -# suppliers or licensors. Title to the Material remains with THC -# or its suppliers and licensors. The Material contains trade secrets and -# proprietary and confidential information of THC or its suppliers and -# licensors. - -# The Material is protected by worldwide copyright and trade secret laws and -# treaty provisions. No part of the Material may be used, copied, reproduced, -# modified, published, uploaded, posted, transmitted, distributed, or disclosed -# in any way without THC's prior express written permission. - -# No license under any patent, copyright, trade secret or other intellectual -# property right is granted to or conferred upon you by disclosure or delivery -# of the Materials, either expressly, by implication, inducement, estoppel or -# otherwise. Any license under such intellectual property rights must be express -# and approved by THC in writing. - -# @organization: THC Science -# @summary: This file parses a JSGF Grammar and prints it out. -# @since: 2014/06/02 - import sys import JSGFGrammar as gram from pyparsing import * diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..4bcd760 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 syntactic + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/ProbabilisticGenerator.py b/ProbabilisticGenerator.py index fbfc021..4af9b29 100644 --- a/ProbabilisticGenerator.py +++ b/ProbabilisticGenerator.py @@ -1,3 +1,29 @@ +# -*- coding: utf-8 -*- +#/usr/bin/python + +# @copyright: MIT License +# Copyright (c) 2018 syntactic (Pastèque Ho) +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# @summary: This file generates sentences from a PCFG in JSGF. Run it by entering +# in the command line: python ProbabilisticGenerator.py +# where is the path of the JSGF file, and is the number +# of strings you want to generate +# @since: 2014/06/02 + """ This file probabilistically generates strings from a JSGF grammar. It takes advantage \ of weights assigned to alternatives (separated by pipes) by choosing to \ @@ -17,33 +43,6 @@ weights if they are provided. """ -#/usr/bin/python -# @copyright: (c)Copyright 2014, THC All Rights Reserved. -# The source code contained or described here in and all documents related -# to the source code ("Material") are owned by THC or its -# suppliers or licensors. Title to the Material remains with THC -# or its suppliers and licensors. The Material contains trade secrets and -# proprietary and confidential information of THC or its suppliers and -# licensors. - -# The Material is protected by worldwide copyright and trade secret laws and -# treaty provisions. No part of the Material may be used, copied, reproduced, -# modified, published, uploaded, posted, transmitted, distributed, or disclosed -# in any way without THC's prior express written permission. - -# No license under any patent, copyright, trade secret or other intellectual -# property right is granted to or conferred upon you by disclosure or delivery -# of the Materials, either expressly, by implication, inducement, estoppel or -# otherwise. Any license under such intellectual property rights must be express -# and approved by THC in writing. - -# @organization: THC Science -# @summary: This file generates sentences from a PCFG in JSGF. Run it by entering -# in the command line: python ProbabilisticGenerator.py -# where is the path of the JSGF file, and is the number -# of strings you want to generate -# @since: 2014/06/02 - import sys, itertools, random, bisect, argparse import JSGFParser as parser import JSGFGrammar as gram diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..054fc21 --- /dev/null +++ b/setup.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +from setuptools import setup, find_packages + +setup( + + name='JSGFTools', + version='1', + url='https://github.com/syntactic/JSGFTools', + author='timothyakho@gmail.com', + license='MIT' + +) \ No newline at end of file