<commit_before>//
//  Generators.swift
//  LexisDatabase
//
//  Created by <NAME> on 9/2/16.
//  Copyright © 2016 RedRoma, Inc. All rights reserved.
//

import AlchemyGenerator
import Foundation
@testable import LexisDatabase

struct Generators
{
    static let dictionary = LexisEngine.instance.readTextFile()!
    static let words = LexisEngine.instance.getAllWords()
    static let lines = Generators.dictionary.components(separatedBy: "\n").filter(String.isNotEmpty)
    
    static var randomWord: LexisWord
    {
        return words.anyElement!
    }
    
    static var randomLine: String
    {
        let randomLineNumber = AlchemyGenerator.integer(from: 1, to: 30_000)
        return lines[randomLineNumber]
    }
    
    static var randomWordType: WordType
    {
        let index = AlchemyGenerator.integer(from: 0, to: 10)
        
        switch index
        {
            case 0 :
                return WordType.Adjective
            case 1:
                return .Adjective
            case 2:
                return WordType.Conjunction
            case 3:
                return WordType.Interjection
            case 4:
                return WordType.Noun(Declension.Vocative, .Neuter)
            case 5:
                return WordType.Numeral
            case 6:
                return WordType.PersonalPronoun
            case 7:
                return WordType.Preposition(Declension.Ablative)
            default:
                return WordType.Verb(Conjugation.First, .Transitive)
        }
    }
    
    static var randomAge: Age
    {
        return Age.ages.anyElement!
    }
    
    static var randomSubject: SubjectArea
    {
        return SubjectArea.areas.anyElement!
    }
    
    static var randomGeography: GeographicalArea
    {
        return GeographicalArea.geophraphies.anyElement!
    }
    
    static var randomFrequency: Frequency
    {
        return Frequency.frequencies.anyElement!
    }
    
    static var randomSource: Source
    {
        return Source.sources.anyElement!
    }
}

func allIntegers(from: Int, to: Int) -> [Int]
{
    var array = [Int]()
    
    for i in (from...to)
    {
        array.append(i)
    }
    
    return array<commit_msg>Adds random supplemental information generation<commit_after>//
//  Generators.swift
//  LexisDatabase
//
//  Created by <NAME> on 9/2/16.
//  Copyright © 2016 RedRoma, Inc. All rights reserved.
//

import AlchemyGenerator
import Foundation
@testable import LexisDatabase

struct Generators
{
    static let dictionary = LexisEngine.instance.readTextFile()!
    static let words = LexisEngine.instance.getAllWords()
    static let lines = Generators.dictionary.components(separatedBy: "\n").filter(String.isNotEmpty)
    
    static var randomWord: LexisWord
    {
        return words.anyElement!
    }
    
    static var randomLine: String
    {
        let randomLineNumber = AlchemyGenerator.integer(from: 1, to: 30_000)
        return lines[randomLineNumber]
    }
    
    static var randomWordType: WordType
    {
        let index = AlchemyGenerator.integer(from: 0, to: 10)
        
        switch index
        {
            case 0 :
                return WordType.Adjective
            case 1:
                return .Adjective
            case 2:
                return WordType.Conjunction
            case 3:
                return WordType.Interjection
            case 4:
                return WordType.Noun(Declension.Vocative, .Neuter)
            case 5:
                return WordType.Numeral
            case 6:
                return WordType.PersonalPronoun
            case 7:
                return WordType.Preposition(Declension.Ablative)
            default:
                return WordType.Verb(Conjugation.First, .Transitive)
        }
    }
    
    static var randomAge: Age
    {
        return Age.ages.anyElement!
    }
    
    static var randomSubject: SubjectArea
    {
        return SubjectArea.areas.anyElement!
    }
    
    static var randomGeography: GeographicalArea
    {
        return GeographicalArea.geophraphies.anyElement!
    }
    
    static var randomFrequency: Frequency
    {
        return Frequency.frequencies.anyElement!
    }
    
    static var randomSource: Source
    {
        return Source.sources.anyElement!
    }
    
    static var randomSupplementalInformation: LexisWord.SupplementalInformation
    {
        return LexisWord.SupplementalInformation(age: randomAge, subjectArea: randomSubject, geographicalArea: randomGeography, frequency: randomFrequency, source: randomSource)
    }
}

func allIntegers(from: Int, to: Int) -> [Int]
{
    var array = [Int]()
    
    for i in (from...to)
    {
        array.append(i)
    }
    
    return array
{'fraction_non_alphanumeric': 0.07463630613535736, 'fraction_numerical': 0.010541851149061775, 'mean_word_length': 1.8838905775075987, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2006085', 'n_tokens_mistral': 1410, 'n_tokens_neox': 1298, 'n_words': 320}