Chomsky Random Sentence Generator

This include file implements a utility function, getRandomText(), to return a random sentence. The sentence returned is a proper English sentence, but is of course complete jibberish. Such sentences are useful for creating test data or confusing managers.

//  Chomsky Random Sentence generator.

    This file contains the following:

    A utility function, getRandomText(), to return a random sentence.
    The sentence returned is a proper English sentence, but is of course
    complete jibberish. Such sentences are useful for creating test data.

    A DOORS template for a requiremnets specification.
    Similar templates can be found in the standard DOORS installation.

    Tony Goodman

		Introductory Phrases
	const string introPhrases[] = {
	"To characterize a linguistic level L, ",
	"On the other hand, ",
	"This suggests that ",
	"It appears that ",
	"Furthermore, ",
	"We will bring evidence in favor of the following thesis: ",
	"To provide a constituent structure for T(Z,K), ",
	"From C1, it follows that ",
	"For any transformation which is sufficiently diversified in application to be of any interest, ",
	"Analogously, ",
	"Clearly, ",
	"Note that ",
	"Of course, ",
	"Suppose, for instance, that ",
	"Thus ",
	"With this clarification, ",
	"Conversely, ",
	"We have already seen that ",
	"By combining adjunctions and certain deformations, ",
	"I suggested that these results would follow from the assumption that ",
	"If the position of the trace in (99c) were only relatively inaccessible to movement, ",
	"However, this assumption is not correct, since ",
	"Comparing these examples with their parasitic gap counterparts in (96) and (97), we see that ",
	"In the discussion of resumptive pronouns following (81), ",
	"So far, ",
	"Nevertheless, ",
	"For one thing, ",
	"Summarizing, then, we assume that ",
	"A consequence of the approach just outlined is that ",
	"Presumably, ",
	"On our assumptions, ",
	"It may be, then, that ",
	"It must be emphasized, once again, that ",
	"Let us continue to suppose that ",
	"Notice, incidentally, that "}

		Subject Phrases
	const string subjectPhrases[] = {
	"the notion of level of grammaticalness ",
	"a case of semigrammaticalness of a different sort ",
	"most of the methodological work in modern linguistics ",
	"a subset of English sentences interesting on quite independent grounds ",
	"the natural general principle that will subsume this case ",
	"an important property of these three types of EC ",
	"any associated supporting element ",
	"the appearance of parasitic gaps in domains relatively inaccessible to ordinary extraction ",
	"the speaker-hearer's linguistic intuition ",
	"the descriptive power of the base component ",
	"the earlier discussion of deviance ",
	"this analysis of a formative as a pair of sets of features ",
	"this selectionally introduced contextual feature ",
	"a descriptively adequate grammar ",
	"the fundamental error of regarding functional notions as categorial ",
	"relational information ",
	"the systematic use of complex symbols ",
	"the theory of syntactic features developed earlier " }

		Verb Phrases
	const string verbPhrases[] = {
	"can be defined in such a way as to impose ",
	"delimits ",
	"suffices to account for ",
	"cannot be arbitrary in ",
	"is not subject to ",
	"does not readily tolerate ",
	"raises serious doubts about ",
	"is not quite equivalent to ",
	"does not affect the structure of ",
	"may remedy and, at the same time, eliminate ",
	"is not to be considered in determining ",
	"is to be regarded as ",
	"is unspecified with respect to ",
	"is, apparently, determined by ",
	"is necessary to impose an interpretation on ",
	"appears to correlate rather closely with ",
	"is rather different from " }

		Object Phrases
	const string objectPhrases[] = {
	"problems of phonemic and morphological analysis.",
	"a corpus of utterance tokens upon which conformity has been defined by the paired utterance test.",
	"the traditional practice of grammarians.",
	"the levels of acceptability from fairly high (eg (99a)) to virtual gibberish (eg (98d)).",
	"a stipulation to place the constructions into these various categories.",
	"a descriptive fact.",
	"a parasitic gap construction.",
	"the extended c-command discussed in connection with (34).",
	"the ultimate standard that determines the accuracy of any proposed grammar.",
	"the system of base rules exclusive of the lexicon.",
	"irrelevant intervening contexts in selectional rules.",
	"nondistinctness in the sense of distinctive feature theory.",
	"a general convention regarding the forms of the grammar.",
	"an abstract underlying order.",
	"an important distinction in language use.",
	"the requirement that branching is not tolerated within the dominance scope of a complex symbol.",
	"the strong generative capacity of the theory." }

Template srsTemplate = template 	"SCOPE" <<
	"Identification" <>
	"System Overview" <>
	"Document Overview" <<
	"Definitions and Interpretation" <>
	"General Tolerance" <>
	"Units" <>
	"Deviation" <>
	"Precedence" >> 1 >>
	"Government Documents" <<
	"US Military Specifications" <>
	"US Military Standards" <>
	"US Military Handbooks" <>
	"US Federal Standards" <>
	"UK Defence Standards" <>
	"Other government standards/specifications" >>
	"Non-Government Documents" <<
	"Buyer's Documents" <>
	"National (e.g. British) Standards" <>
	"European Standards" <>
	"Supplier's Documents" <>
	"Other Documents" >> 1 >>
	"Required States and Modes" <>
	"CSCI Functional Requirements" <<
	"Capability X" <>
	"Capability Y (etc)" >>
	"External Interface Requirements" <<
	"Interface Identification and Diagrams" <>
	"External Interfaces" >>
	"Internal Interface Requirements" <>
	"Internal Data Requirements" <>
	"Adaptation Requirements" <>
	"Safety Requirements" <<
	"Flight Safety" <<
	"Identified Hazards" <>
	"Hazard Probabilities" <>
	"Design Standards" >> 1 >>
	"Security and Privacy Requirements" <>
	"CSCI Environmental Requirements" <>
	"Computer Resource Requirements" <<
	"Computer Hardware Requirements" <>
	"Computer Hardware Resource Utilisation Requirements" <>
	"Included Software Requirements" <>
	"Computer Communications Requirements" >>
	"Software Quality Factors" <>
	"Design and Implementation Constraints" <<
	"Required Programming Language" <>
	"Required Use of Design Standards/Methodology" <>
	"Required Use of Implementation Standards/Methodology" <>
	"Required Software Architecture" <>
	"Other Design Requirements" >>
	"Personnel Requirements" <<
	"Simultaneous Users" <>
	"Human Engineering" <>
	"Personnel Skill" <>
	"Training Requirements" <>
	"Logistics-related Requirements" <>
	"Packaging requirements" <>
	"Other Requirements" >> 1 >>
	"Responsibility for Validation" <>
	"Validation Cross-Reference" <>
	"Special Means of Validation" >>
	"NOTES" <<
	"Abbreviations and Acronyms" <>
	"Glossary" >>

string getPhrase(string phrases[])
	int c = 0

	c = random(sizeof(phrases))

	return(phrases [ c ])

string getRandomText()
	Buffer myLine = create
	int i = 0

		myLine = ""
		myLine += getPhrase(introPhrases)
		myLine += getPhrase(subjectPhrases)
		myLine += getPhrase(verbPhrases)
		myLine += getPhrase(objectPhrases)