Skip to content

Rename mlContext.Data.TextReader() to mlContext.Data.CreateTextLoader() #1690

Closed
@CESARDELATORRE

Description

@CESARDELATORRE

Since the object being created is a "TextLoader", I'd recommend the method's name to say so, instead of "TextReader" which looks like a different type.

I mean code like the following feels confusing:

            TextLoader textLoader = mlContext.Data.TextReader(new TextLoader.Arguments()
                                                    {
                                                        Separator = "tab",
                                                        HasHeader = true,
                                                        Column = new[]
                                                                    {
                                                                    new TextLoader.Column("Label", DataKind.Bool, 0),
                                                                    new TextLoader.Column("Text", DataKind.Text, 1)
                                                                    }
                                                    });

In addition to that, methods should have a verb as part of the name, so if what it is doing is to create a TextReader, let's say so, as:

mlContext.Data.CreateTextLoader()

We're not being consistent now when having some methods with a verb but other methods just a noun:

image

It is also against C# conventions (and most languages). A method's name should have a verb describing the action being performed by that method:

https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/names-of-type-members#names-of-methods

Metadata

Metadata

Assignees

Labels

APIIssues pertaining the friendly API

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions