Skip to content
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
7 changes: 4 additions & 3 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
"isRoot": true,
"tools": {
"csharpier": {
"version": "0.27.2",
"version": "1.2.6",
"commands": [
"dotnet-csharpier"
]
"csharpier"
],
"rollForward": false
}
}
}
5 changes: 5 additions & 0 deletions .csharpierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.config
*.csproj
*.props
*.targets
*.xml
26 changes: 13 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ jobs:
cmake-args: "-A x64"

steps:
- uses: actions/checkout@v4
- uses: lukka/get-cmake@v3.31.6
- uses: actions/checkout@v6
- uses: lukka/get-cmake@v4.2.3

- name: Setup .NET
uses: actions/setup-dotnet@v4
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
10.0.x

- name: Restore dotnet tools
run: dotnet tool restore
Expand All @@ -51,21 +51,21 @@ jobs:
cmake --build ${{ github.workspace }}/src/sentencepiece4c/build --config Release --target sentencepiece4c

- name: Upload sentencepiece4c artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.sentencepiece4c-artifact }}
path: ${{ github.workspace }}/src/sentencepiece4c/bin/${{ matrix.sentencepiece4c-dll }}

- name: Restore dependencies
run: dotnet restore
- name: Check formatting
run: dotnet csharpier --check .
run: dotnet csharpier check .
- name: Build
run: dotnet build --no-restore -c Release
- name: Test
run: dotnet test --verbosity normal --collect:"Xplat Code Coverage"
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

Expand All @@ -75,20 +75,20 @@ jobs:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Setup .NET
uses: actions/setup-dotnet@v4
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
10.0.x

- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v7
with:
name: sp4c-linux-x64
path: ${{ github.workspace }}/src/sentencepiece4c/bin

- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v7
with:
name: sp4c-win-x64
path: ${{ github.workspace }}/src/sentencepiece4c/bin
Expand All @@ -105,7 +105,7 @@ jobs:
dotnet pack src\SIL.Machine.Translation.TensorFlow\SIL.Machine.Translation.TensorFlow.csproj -c Release -o artifacts

- name: Upload package
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: nuget-package
path: artifacts/*.nupkg
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@ tests/SIL.Machine.Tests/Corpora/TestData/usfm/source/*
tests/SIL.Machine.Tests/Corpora/TestData/usfm/target/*
tests/SIL.Machine.Tests/Corpora/TestData/project/*
tests/SIL.Machine.Tests/Corpora/TestData/pretranslations.json
.idea
2 changes: 1 addition & 1 deletion local_check.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
dotnet tool restore
dotnet restore
dotnet csharpier --check .
dotnet csharpier check .
if [ $? -ne 0 ]; then
exit 1
fi
Expand Down
4 changes: 2 additions & 2 deletions src/SIL.Machine.Morphology.HermitCrab.Tool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static int Main(string[] args)
"continues when an error occurs while loading the configuration",
value => quitOnError = value == null
},
{ "h|help", "show this help message and exit", value => showHelp = value != null }
{ "h|help", "show this help message and exit", value => showHelp = value != null },
};

try
Expand Down Expand Up @@ -91,7 +91,7 @@ public static int Main(string[] args)
new ParseCommand(context),
new TracingCommand(context),
new TestCommand(context),
new StatsCommand(context)
new StatsCommand(context),
};

string input;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<RootNamespace>SIL.Machine.Morphology.HermitCrab</RootNamespace>
<PackAsTool>true</PackAsTool>
<ToolCommandName>hc</ToolCommandName>
Expand Down
4 changes: 2 additions & 2 deletions src/SIL.Machine.Morphology.HermitCrab/AllomorphEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Pattern<Word, ShapeNode> rightEnv
Filter = ann =>
ann.Type()
.IsOneOf(HCFeatureSystem.Segment, HCFeatureSystem.Boundary, HCFeatureSystem.Anchor)
&& !ann.IsDeleted()
&& !ann.IsDeleted(),
}
);
}
Expand All @@ -55,7 +55,7 @@ Pattern<Word, ShapeNode> rightEnv
Filter = ann =>
ann.Type()
.IsOneOf(HCFeatureSystem.Segment, HCFeatureSystem.Boundary, HCFeatureSystem.Anchor)
&& !ann.IsDeleted()
&& !ann.IsDeleted(),
}
);
}
Expand Down
2 changes: 0 additions & 2 deletions src/SIL.Machine.Morphology.HermitCrab/CompileException.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace SIL.Machine.Morphology.HermitCrab
{
Expand Down
2 changes: 1 addition & 1 deletion src/SIL.Machine.Morphology.HermitCrab/ConstraintType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
public enum ConstraintType
{
Require,
Exclude
Exclude,
}
}
8 changes: 4 additions & 4 deletions src/SIL.Machine.Morphology.HermitCrab/HCFeatureSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static HCFeatureSystem()

Type = new SymbolicFeature(Guid.NewGuid().ToString(), Anchor, Segment, Boundary, Morph)
{
Description = "Type"
Description = "Type",
};

Dirty = new FeatureSymbol(Guid.NewGuid().ToString()) { Description = "Dirty" };
Expand All @@ -51,7 +51,7 @@ static HCFeatureSystem()
Modified = new SymbolicFeature(Guid.NewGuid().ToString(), Dirty, Clean)
{
Description = "Modified",
DefaultValue = new SymbolicFeatureValue(Clean)
DefaultValue = new SymbolicFeatureValue(Clean),
};

Deleted = new FeatureSymbol(Guid.NewGuid().ToString()) { Description = "Deleted" };
Expand All @@ -60,15 +60,15 @@ static HCFeatureSystem()
Deletion = new SymbolicFeature(Guid.NewGuid().ToString(), Deleted, NotDeleted)
{
Description = "Deletion",
DefaultValue = new SymbolicFeatureValue(NotDeleted)
DefaultValue = new SymbolicFeatureValue(NotDeleted),
};

LeftSide = new FeatureSymbol(Guid.NewGuid().ToString()) { Description = "LeftSide" };
RightSide = new FeatureSymbol(Guid.NewGuid().ToString()) { Description = "RightSide" };

AnchorType = new SymbolicFeature(Guid.NewGuid().ToString(), LeftSide, RightSide)
{
Description = "AnchorType"
Description = "AnchorType",
};

StrRep = new StringFeature(Guid.NewGuid().ToString()) { Description = "StrRep" };
Expand Down
2 changes: 1 addition & 1 deletion src/SIL.Machine.Morphology.HermitCrab/ITraceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public enum FailureReason
BoundRoot,
NonPartialRuleProhibitedAfterFinalTemplate,
NonPartialRuleRequiredAfterNonFinalTemplate,
MaxApplicationCount
MaxApplicationCount,
}

public interface ITraceManager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public enum MorphCoOccurrenceAdjacency
/// <summary>
/// Adjacent to the right
/// </summary>
AdjacentToRight
AdjacentToRight,
}

/// <summary>
Expand Down
1 change: 0 additions & 1 deletion src/SIL.Machine.Morphology.HermitCrab/Morpher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#if !SINGLE_THREADED
using System.Collections.Concurrent;
using System.Threading.Tasks;
using System.Text;
#endif

namespace SIL.Machine.Morphology.HermitCrab
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public enum ReduplicationHint
/// <summary>
/// Suffix
/// </summary>
Suffix
Suffix,
}

public class AffixProcessAllomorph : Allomorph
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public AnalysisAffixProcessRule(Morpher morpher, AffixProcessRule rule)
MatchingMethod = MatchingMethod.Unification,
AnchoredToStart = true,
AnchoredToEnd = true,
AllSubmatches = true
AllSubmatches = true,
}
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public AnalysisCompoundingRule(Morpher morpher, CompoundingRule rule)
MatchingMethod = MatchingMethod.Unification,
AnchoredToStart = true,
AnchoredToEnd = true,
AllSubmatches = true
AllSubmatches = true,
}
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public AnalysisRealizationalAffixProcessRule(Morpher morpher, RealizationalAffix
MatchingMethod = MatchingMethod.Unification,
AnchoredToStart = true,
AnchoredToEnd = true,
AllSubmatches = true
AllSubmatches = true,
}
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public SynthesisAffixProcessRule(Morpher morpher, AffixProcessRule rule)
ann.Type().IsOneOf(HCFeatureSystem.Segment, HCFeatureSystem.Boundary)
&& !ann.IsDeleted(),
AnchoredToStart = true,
AnchoredToEnd = true
AnchoredToEnd = true,
}
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private Matcher<Word, ShapeNode> BuildMatcher(IEnumerable<Pattern<Word, ShapeNod
Filter = ann =>
ann.Type().IsOneOf(HCFeatureSystem.Segment, HCFeatureSystem.Boundary) && !ann.IsDeleted(),
AnchoredToStart = true,
AnchoredToEnd = true
AnchoredToEnd = true,
}
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public SynthesisRealizationalAffixProcessRule(Morpher morpher, RealizationalAffi
ann.Type().IsOneOf(HCFeatureSystem.Segment, HCFeatureSystem.Boundary)
&& !ann.IsDeleted(),
AnchoredToStart = true,
AnchoredToEnd = true
AnchoredToEnd = true,
}
)
);
Expand Down
4 changes: 2 additions & 2 deletions src/SIL.Machine.Morphology.HermitCrab/MprFeatureGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public enum MprFeatureGroupMatchType
/// <summary>
/// only if all features match within the group
/// </summary>
All
All,
}

/// <summary>
Expand All @@ -33,7 +33,7 @@ public enum MprFeatureGroupOutput
/// <summary>
/// appends features
/// </summary>
Append
Append,
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public AnalysisMetathesisRule(Morpher morpher, MetathesisRule rule)
UseDefaults = true,
// during analysis shape nodes can have features that are underspecified,
// so this must be non-deterministic
Nondeterministic = true
Nondeterministic = true,
};

_patternRule = new IterativePhonologicalPatternRule(ruleSpec, settings);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ private enum ReapplyType
{
Normal,
Deletion,
SelfOpaquing
SelfOpaquing,
}

private readonly Morpher _morpher;
Expand All @@ -35,7 +35,7 @@ public AnalysisRewriteRule(Morpher morpher, RewriteRule rule)
MatchingMethod = MatchingMethod.Unification,
UseDefaults = true,
// during analysis shape nodes can have features that are underspecified, so this must be non-deterministic
Nondeterministic = true
Nondeterministic = true,
};

_rules = new List<Tuple<ReapplyType, PhonologicalPatternRule>>();
Expand Down Expand Up @@ -142,15 +142,13 @@ public IEnumerable<Word> Apply(Word input)
switch (sr.Item1)
{
case ReapplyType.Normal:

{
if (sr.Item2.Apply(input).Any())
srApplied = true;
}
break;

case ReapplyType.Deletion:

{
int j = 0;
Word data = sr.Item2.Apply(input).SingleOrDefault();
Expand All @@ -166,7 +164,6 @@ public IEnumerable<Word> Apply(Word input)
break;

case ReapplyType.SelfOpaquing:

{
Word data = sr.Item2.Apply(input).SingleOrDefault();
while (data != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace SIL.Machine.Morphology.HermitCrab.PhonologicalRules
public enum RewriteApplicationMode
{
Iterative,
Simultaneous
Simultaneous,
}

public class RewriteRule : HCRuleBase, IPhonologicalRule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public SynthesisMetathesisRule(Morpher morpher, MetathesisRule rule)
Filter = ann =>
ann.Type().IsOneOf(HCFeatureSystem.Segment, HCFeatureSystem.Boundary, HCFeatureSystem.Anchor)
&& !ann.IsDeleted(),
UseDefaults = true
UseDefaults = true,
};

_patternRule = new IterativePhonologicalPatternRule(ruleSpec, settings);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public SynthesisRewriteRule(Morpher morpher, RewriteRule rule)
Filter = ann =>
ann.Type().IsOneOf(HCFeatureSystem.Segment, HCFeatureSystem.Boundary, HCFeatureSystem.Anchor)
&& !ann.IsDeleted(),
UseDefaults = true
UseDefaults = true,
};

var ruleSpec = new SynthesisRewriteRuleSpec(
Expand Down
Loading
Loading