Skip to content

Refactoring related to namespaces and public input/output classes. #3222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Microsoft.ML;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
public static class ApplyCustomWordEmbedding
{
Expand Down Expand Up @@ -67,12 +67,12 @@ public static void Example()
// Features: -1.0000 0.0000 -100.0000 0.0000 34.0000 -25.6667 1.0000 100.0000 20.0000
}

public class TextData
private class TextData
{
public string Text { get; set; }
}

public class TransformedTextData : TextData
private class TransformedTextData : TextData
{
public float[] Features { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.ML;
using Microsoft.ML.Transforms.Text;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
public static class ApplyWordEmbedding
{
Expand All @@ -29,8 +30,8 @@ public static void Example()
// The pipeline first normalizes and tokenizes text then applies word embedding transformation.
var textPipeline = mlContext.Transforms.Text.NormalizeText("Text")
.Append(mlContext.Transforms.Text.TokenizeIntoWords("Tokens", "Text"))
.Append(mlContext.Transforms.Text.ApplyWordEmbedding("Features", "Tokens",
Transforms.Text.WordEmbeddingEstimator.PretrainedModelKind.SentimentSpecificWordEmbedding));
.Append(mlContext.Transforms.Text.ApplyWordEmbedding("Features", "Tokens",
WordEmbeddingEstimator.PretrainedModelKind.SentimentSpecificWordEmbedding));

// Fit to data.
var textTransformer = textPipeline.Fit(emptyDataView);
Expand All @@ -55,12 +56,12 @@ public static void Example()
// Features: -1.2489 0.2384 -1.3034 -0.9135 -3.4978 -0.1784 -1.3823 -0.3863 -2.5262 -0.8950 ...
}

public class TextData
private class TextData
{
public string Text { get; set; }
}

public class TransformedTextData : TextData
private class TransformedTextData : TextData
{
public float[] Features { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using Microsoft.ML.Data;
using Microsoft.ML;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
public static class FeaturizeText
{
Expand Down Expand Up @@ -60,12 +60,12 @@ public static void Example()
// Features: 0.0857 0.0857 0.0857 0.0857 0.0857 0.0857 0.0857 0.0857 0.0857 0.1715 ...
}

public class TextData
private class TextData
{
public string Text { get; set; }
}

public class TransformedTextData : TextData
private class TransformedTextData : TextData
{
public float[] Features { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using Microsoft.ML.Data;
using Microsoft.ML;
using Microsoft.ML.Transforms.Text;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
public static class FeaturizeTextWithOptions
{
Expand Down Expand Up @@ -67,12 +67,12 @@ public static void Example()
// Tokens: ml.net's,featurizetext,api,uses,composition,basic,transforms,convert,text,numeric,features.
}

public class TextData
private class TextData
{
public string Text { get; set; }
}

public class TransformedTextData : TextData
private class TransformedTextData : TextData
{
public float[] Features { get; set; }
public string[] OutputTokens { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using Microsoft.ML.Data;
using Microsoft.ML;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
public static class LatentDirichletAllocation
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.ML;
using Microsoft.ML.Transforms.Text;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
public static class NormalizeText
{
Expand All @@ -22,7 +23,7 @@ public static void Example()

// A pipeline for normalizing text.
var normTextPipeline = mlContext.Transforms.Text.NormalizeText("NormalizedText", "Text",
Transforms.Text.TextNormalizingEstimator.CaseMode.Lower,
TextNormalizingEstimator.CaseMode.Lower,
keepDiacritics: false,
keepPunctuations: false,
keepNumbers: false);
Expand All @@ -44,12 +45,12 @@ public static void Example()
// Normalized Text: mlnets normalizetext api changes the case of the text and removeskeeps diacritics punctuations andor numbers
}

public class TextData
private class TextData
{
public string Text { get; set; }
}

public class TransformedTextData : TextData
private class TransformedTextData : TextData
{
public string NormalizedText { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using Microsoft.ML;
using Microsoft.ML.Data;
using Microsoft.ML.Transforms.Text;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
public static class ProduceHashedNgrams
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.ML;
using Microsoft.ML.Data;
using Microsoft.ML.Transforms.Text;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
public static class ProduceHashedWordBags
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using System;
using System.Collections.Generic;
using Microsoft.ML;
using Microsoft.ML.Data;
using Microsoft.ML.Transforms.Text;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
public static class ProduceNgrams
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.ML;
using Microsoft.ML.Data;
using Microsoft.ML.Transforms.Text;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
public static class ProduceWordBags
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using System;
using System.Collections.Generic;
using Microsoft.ML;
using Microsoft.ML.Transforms.Text;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
public static class RemoveDefaultStopWords
{
Expand Down Expand Up @@ -47,12 +48,12 @@ public static void Example()
// Words without stop words: ML.NET's,RemoveDefaultStopWords,API,removes,stop,words,text/string.,requires,text/string,tokenized,beforehand.
}

public class TextData
private class TextData
{
public string Text { get; set; }
}

public class TransformedTextData : TextData
private class TransformedTextData : TextData
{
public string[] WordsWithoutStopWords { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using Microsoft.ML.Transforms.Text;
using Microsoft.ML;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
public static class RemoveStopWords
{
Expand Down Expand Up @@ -47,12 +47,12 @@ public static void Example()
// Words without stop words: ML.NET's,RemoveStopWords,API,removes,stop,words,text/string,using,list,of,stop,words,provided,user.
}

public class TextData
private class TextData
{
public string Text { get; set; }
}

public class TransformedTextData : TextData
private class TransformedTextData : TextData
{
public string[] WordsWithoutStopWords { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.ML;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
public static class TokenizeIntoCharactersAsKeys
{
Expand Down Expand Up @@ -50,12 +50,12 @@ public static void Example()
// <?>: is a unicode control character used instead of spaces ('\u2400').
}

public class TextData
private class TextData
{
public string Text { get; set; }
}

public class TransformedTextData : TextData
private class TransformedTextData : TextData
{
public string[] CharTokens { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.ML;

namespace Microsoft.ML.Samples.Dynamic
namespace Samples.Dynamic
{
public static class TokenizeIntoWords
{
Expand Down Expand Up @@ -46,12 +46,12 @@ public static void Example()
// Words: ML.NET's,TokenizeIntoWords,API,splits,text/string,into,words,using,the,list,of,characters,provided,as,separators.
}

public class TextData
private class TextData
{
public string Text { get; set; }
}

public class TransformedTextData : TextData
private class TransformedTextData : TextData
{
public string[] Words { get; set; }
}
Expand Down