https://github.com/71/Albion
Translating human-readable sentences to methods with parameters had never been so easy.
https://github.com/71/Albion
Last synced: 12 months ago
JSON representation
Translating human-readable sentences to methods with parameters had never been so easy.
- Host: GitHub
- URL: https://github.com/71/Albion
- Owner: 71
- License: mit
- Created: 2015-05-15T22:27:06.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2017-03-19T10:53:47.000Z (about 9 years ago)
- Last Synced: 2025-06-10T23:56:26.802Z (about 1 year ago)
- Language: C#
- Homepage: https://6A.github.io/Albion
- Size: 7.45 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Albion
### Get methods from sentences, easily and effectively.
------
## Example:
> Remind me to go to the store to buy chocolates in two days, one hour and fifteen minutes.
#### with:
```csharp
[Sentence("In {time} remind me to {todo}")]
[Sentence("Remind me to {todo} in {time}")]
public static string RemindMeIn(string todo, TimeSpan time)
{
DateTime remindtime = DateTime.Now;
remindtime = remindtime.Add(time);
return "I will remind you to " + todo + " "
+ remindtime.DayOfWeek + ", the " + remindtime.Day + "th of " + remindtime.ToString("MMM yyyy")
+ ", at " + remindtime.ToString("HH:mm") + ".";
}
```
#### will return:
> I will remind you to go to the store to buy chocolates Saturday, the 16th of May 2015, at 00:38.
------
#### It's easy to use
```csharp
Engine engine = new Engine();
engine.Register(typeof(Reminders));
Answer a = engine.Ask("Remind me to go to the store to buy chocolates in two days, one hour and fifteen minutes.");
if (a == null)
Console.WriteLine("No match found");
else if (a.ReturnType == typeof(string))
Console.WriteLine(a.Call());
```
#### Way more than that
See [Wiki](../../wiki) to follow a [getting started](../../wiki/home) guide, learn [advanced uses](../../wiki/advanced-uses) or learn with [examples](../../wiki/examples).