<commit_before>import pathlib
import shutil

import keras_autodoc

import autokeras as ak

PAGES = {
    'image_classifier.md': [
        ak.ImageClassifier,
        ak.ImageClassifier.fit,
        ak.ImageClassifier.predict,
        ak.ImageClassifier.evaluate,
    ],
    'image_regressor.md': [
        ak.ImageRegressor,
        ak.ImageRegressor.fit,
        ak.ImageRegressor.predict,
        ak.ImageRegressor.evaluate,
    ],
    'text_classifier.md': [
        ak.TextClassifier,
        ak.TextClassifier.fit,
        ak.TextClassifier.predict,
        ak.TextClassifier.evaluate,
    ],
    'text_regressor.md': [
        ak.TextRegressor,
        ak.TextRegressor.fit,
        ak.TextRegressor.predict,
        ak.TextRegressor.evaluate,
    ],
    'structured_data_classifier.md': [
        ak.StructuredDataClassifier,
        ak.StructuredDataClassifier.fit,
        ak.StructuredDataClassifier.predict,
        ak.StructuredDataClassifier.evaluate,
    ],
    'structured_data_regressor.md': [
        ak.StructuredDataRegressor,
        ak.StructuredDataRegressor.fit,
        ak.StructuredDataRegressor.predict,
        ak.StructuredDataRegressor.evaluate,
    ],
    'auto_model.md': [
        ak.AutoModel,
        ak.AutoModel.fit,
        ak.AutoModel.predict,
        ak.AutoModel.evaluate,
    ],
    'graph_auto_model.md': [
        ak.GraphAutoModel,
        ak.GraphAutoModel.fit,
        ak.GraphAutoModel.predict,
        ak.GraphAutoModel.evaluate,
    ],
    'node.md': [
        ak.ImageInput,
        ak.Input,
        ak.StructuredDataInput,
        ak.TextInput,
    ],
    'block.md': [
        ak.ConvBlock,
        ak.DenseBlock,
        ak.EmbeddingBlock,
        ak.Merge,
        ak.ResNetBlock,
        ak.RNNBlock,
        ak.SpatialReduction,
        ak.TemporalReduction,
        ak.XceptionBlock,
        ak.ImageBlock,
        ak.StructuredDataBlock,
        ak.TextBlock,
    ],
    'preprocessor.md': [
        ak.FeatureEngineering,
        ak.ImageAugmentation,
        ak.LightGBMBlock,
        ak.Normalization,
        ak.TextToIntSequence,
        ak.TextToNgramVector,
    ],
    'head.md': [
        ak.ClassificationHead,
        ak.RegressionHead,
    ],
}


ROOT = 'http://autokeras.com/'

autokeras_dir = pathlib.Path(__file__).resolve().parents[1]


def generate(dest_dir):
    template_dir = autokeras_dir / 'docs' / 'templates'
    doc_generator = keras_autodoc.DocumentationGenerator(
        PAGES,
        'https://github.com/keras-team/autokeras/blob/master',
        template_dir,
        autokeras_dir / 'examples',
    )
    doc_generator.generate(dest_dir)
    readme = (autokeras_dir / 'README.md').read_text()
    index = (template_dir / 'index.md').read_text()
    index = index.replace('{{autogenerated}}', readme[readme.find('##'):])
    (dest_dir / 'index.md').write_text(index, encoding='utf-8')
    shutil.copyfile(autokeras_dir / '.github' / 'CONTRIBUTING.md',
                    dest_dir / 'contributing.md')


if __name__ == '__main__':
    generate(autokeras_dir / 'docs' / 'sources')
<commit_msg>Now the documentation displays the correct aliases. (#854)<commit_after>import pathlib
import shutil

import keras_autodoc

PAGES = {
    'image_classifier.md': [
        'autokeras.ImageClassifier',
        'autokeras.ImageClassifier.fit',
        'autokeras.ImageClassifier.predict',
        'autokeras.ImageClassifier.evaluate',
    ],
    'image_regressor.md': [
        'autokeras.ImageRegressor',
        'autokeras.ImageRegressor.fit',
        'autokeras.ImageRegressor.predict',
        'autokeras.ImageRegressor.evaluate',
    ],
    'text_classifier.md': [
        'autokeras.TextClassifier',
        'autokeras.TextClassifier.fit',
        'autokeras.TextClassifier.predict',
        'autokeras.TextClassifier.evaluate',
    ],
    'text_regressor.md': [
        'autokeras.TextRegressor',
        'autokeras.TextRegressor.fit',
        'autokeras.TextRegressor.predict',
        'autokeras.TextRegressor.evaluate',
    ],
    'structured_data_classifier.md': [
        'autokeras.StructuredDataClassifier',
        'autokeras.StructuredDataClassifier.fit',
        'autokeras.StructuredDataClassifier.predict',
        'autokeras.StructuredDataClassifier.evaluate',
    ],
    'structured_data_regressor.md': [
        'autokeras.StructuredDataRegressor',
        'autokeras.StructuredDataRegressor.fit',
        'autokeras.StructuredDataRegressor.predict',
        'autokeras.StructuredDataRegressor.evaluate',
    ],
    'auto_model.md': [
        'autokeras.AutoModel',
        'autokeras.AutoModel.fit',
        'autokeras.AutoModel.predict',
        'autokeras.AutoModel.evaluate',
    ],
    'graph_auto_model.md': [
        'autokeras.GraphAutoModel',
        'autokeras.GraphAutoModel.fit',
        'autokeras.GraphAutoModel.predict',
        'autokeras.GraphAutoModel.evaluate',
    ],
    'node.md': [
        'autokeras.ImageInput',
        'autokeras.Input',
        'autokeras.StructuredDataInput',
        'autokeras.TextInput',
    ],
    'block.md': [
        'autokeras.ConvBlock',
        'autokeras.DenseBlock',
        'autokeras.EmbeddingBlock',
        'autokeras.Merge',
        'autokeras.ResNetBlock',
        'autokeras.RNNBlock',
        'autokeras.SpatialReduction',
        'autokeras.TemporalReduction',
        'autokeras.XceptionBlock',
        'autokeras.ImageBlock',
        'autokeras.StructuredDataBlock',
        'autokeras.TextBlock',
    ],
    'preprocessor.md': [
        'autokeras.FeatureEngineering',
        'autokeras.ImageAugmentation',
        'autokeras.LightGBMBlock',
        'autokeras.Normalization',
        'autokeras.TextToIntSequence',
        'autokeras.TextToNgramVector',
    ],
    'head.md': [
        'autokeras.ClassificationHead',
        'autokeras.RegressionHead',
    ],
}


ROOT = 'http://autokeras.com/'

autokeras_dir = pathlib.Path(__file__).resolve().parents[1]


def generate(dest_dir):
    template_dir = autokeras_dir / 'docs' / 'templates'
    doc_generator = keras_autodoc.DocumentationGenerator(
        PAGES,
        'https://github.com/keras-team/autokeras/blob/master',
        template_dir,
        autokeras_dir / 'examples',
    )
    doc_generator.generate(dest_dir)
    readme = (autokeras_dir / 'README.md').read_text()
    index = (template_dir / 'index.md').read_text()
    index = index.replace('{{autogenerated}}', readme[readme.find('##'):])
    (dest_dir / 'index.md').write_text(index, encoding='utf-8')
    shutil.copyfile(autokeras_dir / '.github' / 'CONTRIBUTING.md',
                    dest_dir / 'contributing.md')


if __name__ == '__main__':
    generate(autokeras_dir / 'docs' / 'sources')

{'fraction_non_alphanumeric': 0.12587830766930783, 'fraction_numerical': 0.0010464942442816563, 'mean_word_length': 2.528481012658228, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '1724599', 'n_tokens_mistral': 2257, 'n_tokens_neox': 2186, 'n_words': 243}